prog3b_2533_sp11

# prog3b_2533_sp11 - c5=polyfit(xd,yd,5 y5=polyval(c5,x...

This preview shows page 1. Sign up to view the full content.

% CSC 2533 % Spring 2011 % Assignment 3b [xd yd]=textread('prog3b.dat'); x=0:.001:10; c2=polyfit(xd,yd,2); y2=polyval(c2,x); figure(1); plot(x,y2,'g',xd,yd,'ko'); axis([0 10 2 12]); xlabel('x'); ylabel('2nd Order Polynomial'); title('Assignment 3b, Figure 1'); c3=polyfit(xd,yd,3); y3=polyval(c3,x); figure(2); plot(x,y3,'b',xd,yd,'ko'); axis([0 10 2 12]); xlabel('x'); ylabel('3rd Order Polynomial'); title('Assignment 3b, Figure 2');
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c5=polyfit(xd,yd,5); y5=polyval(c5,x); figure(3); plot(x,y5,'r',xd,yd,'ko'); axis([0 10 2 12]); xlabel('x'); ylabel('5th Order Polynomial'); title('Assignment 3b, Figure 3'); figure(4); plot(x,y2,'g',x,y3,'b',x,y5,'r',xd,yd,'ko'); axis([0 10 2 12]); xlabel('x'); ylabel('2nd(green), 3rd(blue) and 5th(red) Order Polynomial'); title('Assignment 3b, Figure 4');...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online