This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: plotpoly.m : function plotpoly(alpha,k,a,b) % % function which plots the polynomial % alpha(1)*x^k+alpha(2)*x^{k1}+. ...+alpha(k)*x+alpha(k+1) % for x between a and b. k is the degree of the polyomial, and alpha % is a vector of coefficients % h=(ba)/100; for i=1:101 x(i)=a+(i1)*h; sum=0; for j=1:k+1 sum=sum+alpha(j)*x(i)^(k+1j); end y(i)=sum; end plot(x,y) In matlab, type the following commands: >> alpha=[4;2;3;3;2;6]; >> k=5; >> a=2; >> b=2; >> plotpoly(alpha,k,a,b) Print the plot created by these commands. You have just plotted the polynomial 6 + 2 x + 3 x 23 x 3 + 2 x 4 + 4 x 5 on the interval between 2 and 2....
View
Full
Document
This note was uploaded on 03/20/2008 for the course ASE 211 taught by Professor N/a during the Spring '08 term at University of Texas.
 Spring '08
 N/A

Click to edit the document details