prog3a_2533_sp11

prog3a_2533_sp11 - y4=y4/130; figure(2);

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

View Full Document Right Arrow Icon
% CSC 2533, Spring 2011, Assignment 3a x=-1.6:.001:2.2; c1=[128 -64 -178 -21]; y1=polyval(c1,x); y1=y1/15; roots1x=roots(c1); roots1y=[0 0 0]; c2=[3 -5 -8 11 2 -2]; y2=polyval(c2,x); roots2x=roots(c2); roots2y=[0 0 0 0 0]; c3=[128 -176 -208 141 45]; y3=polyval(c3,x); y3=y3/18; roots3x=roots(c3); roots3y=[0 0 0 0]; line1x=[-1.6 2.2]; line1y=[0 0]; figure(1); plot(x,y1,'g',roots1x,roots1y,'go',x,y2,'m',roots2x,roots2y,'mo', . .. x,y3,'b',roots3x,roots3y,'bo',line1x,line1y,'k'); axis([-1.6 2.2 -10 10]); set(gca,'xtick',-1.6:.2:2.2); xlabel('x'); ylabel('y1(green), y2(magenta), y3(blue)'); title('Assignment 3a, Figure 1'); c4=conv(c1,c2); y4=polyval(c4,x);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: y4=y4/130; figure(2); plot(x,y1,'g',roots1x,roots1y,'go',x,y2,'m',roots2x,roots2y,'mo',x,y4,'k', . .. line1x,line1y,'k'); axis([-1.6 2.2 -10 10]); set(gca,'xtick',-1.6:.2:2.2); xlabel('x'); ylabel('y1(green), y2(magenta), product(black)'); title('Assignment 3a, Figure 2'); c5=conv(c1,c3); y5=polyval(c5,x); y5=y5/1500; figure(3); plot(x,y1,'g',roots1x,roots1y,'go',x,y3,'b',roots3x,roots3y,'bo',x,y5,'r', . .. line1x,line1y,'k'); axis([-1.6 2.2 -10 10]); set(gca,'xtick',-1.6:.2:2.2); xlabel('x'); ylabel('y1(green), y3(blue), product(red)'); title('Assignment 3a, Figure 3');...
View Full Document

Ask a homework question - tutors are online