MAT2630 Numerical Methods, FA2015

% problem 3.5.5
a=[0 3 -3 0;2 0 -3 2];
syms t;
T=[1 t t^2 t^3];
B1=a*T.’;
B2=a*T.’-[0;1];
set(groot,’defaultAxesColorOrder’,[0 0 1])
set(groot,’defaultLineLineWidth’,2)
ezplot(B1(1),B1(2),[0 1])
hold on
ezplot(B2(1),B2(2),[0 1])
plot([0,0],[0,2])
hold off

% problem 3.5.7 (CP1)
syms a b c d r s t;
a=[-1 0];
b=3*([-1 r]-[-1 0]);
c=3*([1 s]-[-1 r])-b;
d=([1 0]-[-1 0])-3*([1 s]-[-1 r]);
T=[1 t t^2 t^3];
B=[a;b;c;d].’*T.’
double(solve(B(1)))
s=solve(subs(B(2)==1,t,.5),s)
B=eval(B)
for r=.7:.1:2
clf
hold on
plot([-1,-1,1,1],[0,r,8/3-r,0],’–‘,0,1,’o’)
axis([-1.1,1.1,0,2])
ezplot(B(1),eval(B(2)),[0 1])
pause(.3)
hold off
end

Tags:

Comment display has been disabled on this doc.

Comment posting has been disabled on this doc.