Project 6 Solutions

Project 6 Solutions - -3-2-1123-2-1.5-1-0.50.51PROJECT...

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: -3-2-1123-2-1.5-1-0.50.51PROJECT #6Team Name: The UnknownsMembers:HristianDivyaSofiaAnnon1.(a)>> k=[0 1 2 3 4 5 6];>> x=-3+k;>> y=-abs(x)+1;>> xx=-3:.01:3;>> yy=spline(x,y,xx);>> plot(xx,yy,x,y,'o',x,y)(b)>> k=[0 1 2 3 4 5 6];>> x=-3+k;>> y=zeros(size(x));-3-2-11230.10.20.30.40.50.60.70.80.91>> for i=1:size(y,2);y(i)=1/(1+(x(i)^2));end>> xx=-3:.01:3;>> yy=spline(x,y,xx);>> plot(xx,yy,x,y,'o',x,y)(c) >> k=[0 1 2 3 4 5 6];>> x=-3+k;>> y=sin(x);>> xx=-3:.01:3;>> yy=spline(x,y,xx);>> plot(xx,yy,x,y,'o',x,y)-3-2-1123-1-0.8-0.6-0.4-0.20.20.40.60.812.Matlab code:function C = hermit(x,y,der)len = length(x);C=zeros(len-1,4);A=zeros(4,4);b=zeros(4,1);for i=1:len-1C(i,4)= y(i);C(i,3)= der(i);A(1:2,4)=1;A(3:4,3)=1;A(2,1)=(x(i+1)-x(i))^3;A(2,2)=(x(i+1)-x(i))^2;A(2,3)=(x(i+1)-x(i));A(4,1)=3*A(2,2);A(4,2)=2*A(2,3);b(1)=y(i);b(2)=y(i+1);b(3)=der(i);b(4)=der(i+1);x=A\b;C(i,1)=x(1);C(i,2)=x(2);end>> x=[1 2];>> y=[6 21];>> der=[ 7 25];>> hermit(x,y,der)ans =2.0000 6.0000 7.0000 6.00003.function ys=hermplot(x,y,der,xs)C=hermit(x,y,der);pp=mkpp(x,C);xs=x(1):.01:x(length(x));ys=ppval(pp,xs);4.FINISH UP!!!5.Matlab code:function A = dft(n)A=zeros(n,n);omega=exp((2*i*pi)/n);for r=1:nfor s=1:nA(r,s)=omega^((r-1)*(s-1));endend>> n=5;>> y=rand(n,1);>> A=dft(n);>> fft(y)-n*inv(A)*yans =1.0e-015 *0.4441 + 0.0004i0.3886 - 0.2220i0.1110 - 0.2220i0 -0.2776 + 0.2220i-4-3-2-11234-4-3-2-11234We can see that they are the same.We can see that they are the same....
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 / 14

Project 6 Solutions - -3-2-1123-2-1.5-1-0.50.51PROJECT...

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