Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %f(x)=x.^m [1 2] for m = 1 2 3 4, h=1 (<---order)
- x=1:0.05:2
- k = length(x);
- m=1;
- f1=x.^m;
- fa1=f1(1)+m*1^(m-1)*(x-1);
- figure (1)
- plot (x,f1,'r',x,fa1,'ro')
- xlabel('x')
- ylabel ('f(x)')
- grid
- text (1.8,1.5,'m=1')
- hold on
- m=2;
- f2=x.^m;
- fa2=f2(1)+m*1^(m-1)*(x-1);
- plot (x,f2,'g',x,fa2,'go');
- text (1.8,3.5,'m=2')
- m=3;
- f3=x.^m;
- fa3=f3(1)+m*1^(m-1)*(x-1);
- plot (x,f3,'b',x,fa3,'bo');
- text (1.8,5.5,'m=3')
- m=4;
- f4=x.^m;
- fa4=f4(1)+m*1^(m-1)*(x-1);
- plot (x,f4,'y',x,fa4,'yo');
- text (1.8,7.5,'m=4')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement