Project 5 Solutions

Project 5 Solutions - PROJECT#5 Team Name The Unknowns Members Hristian Divya Sofia Annon 1 function polyplot(c,xs ys=size(xs for i=1:size(xs

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: PROJECT #5 Team Name: The Unknowns Members: Hristian Divya Sofia Annon 1. function polyplot(c,xs) ys=size(xs); for i=1:size(xs) ys=polyval(c,xs); end plot(xs,ys)------------------------------------------------------------------------------------------------------------ 2. (1) >> xs=0:pi/50:pi; >> ys=sin(xs); >> plot(xs,ys) 0.5 1 1.5 2 2.5 3 3.5 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 (2) >> x=0:pi/4:pi; >> y=sin(x); >> plot(x,y,'*') 0.5 1 1.5 2 2.5 3 3.5 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 (3) >> A=vander(x'); >> a=A\y'; >> polyplot(a',x) 0.5 1 1.5 2 2.5 3 3.5 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 (4) >> Lys=polyval(a',xs); >> max(abs(ys-Lys)) ans = 0.0018------------------------------------------------------------------------------------------------------------ 3. (1) >> xs=-1:1/50:1; >> ys=-(abs(xs))+1; >> plot(xs,ys) (2) >> x=-1:.4:1; >> y=-abs(x)+1; >> plot(x,y,'*') (3) >> A=vander(x'); >> a=A\y'; >> polyplot(a',x)-1-0.8-0.6-0.4-0.2 0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 (4) >> Lys=polyval(a',xs); >> max(abs(ys-Lys)) ans = 0.1406------------------------------------------------------------------------------------------------------------ 4. >> xs=-10:.05:10; >> ys=zeros(size(xs)); >> for i=1:size(ys,2);ys(i)=1/(1+(xs(i)^2));end >> plot(xs,ys) >> hold Current plot held >> x=-10:2:10; >> y=zeros(size(x)); >> for i=1:size(y,2);y(i)=1/(1+(x(i)^2));end >> plot(x,y,'*') >> A=vander(x'); >> a=A\y';-10...
View Full Document

This note was uploaded on 09/10/2008 for the course MAD 4401 taught by Professor Martcheva during the Spring '08 term at University of Florida.

Page1 / 20

Project 5 Solutions - PROJECT#5 Team Name The Unknowns Members Hristian Divya Sofia Annon 1 function polyplot(c,xs ys=size(xs for i=1:size(xs

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online