Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. %f(x)=x.^m [1 2] for m = 1 2 3 4, h=1 (<---order)
  2. x=1:0.05:2
  3. k = length(x);
  4. m=1;
  5. f1=x.^m;
  6. fa1=f1(1)+m*1^(m-1)*(x-1);
  7. figure (1)
  8. plot (x,f1,'r',x,fa1,'ro')
  9. xlabel('x')
  10. ylabel ('f(x)')
  11. grid
  12. text (1.8,1.5,'m=1')
  13. hold on
  14.  
  15. m=2;
  16. f2=x.^m;
  17. fa2=f2(1)+m*1^(m-1)*(x-1);
  18. plot (x,f2,'g',x,fa2,'go');
  19. text (1.8,3.5,'m=2')
  20.  
  21. m=3;
  22. f3=x.^m;
  23. fa3=f3(1)+m*1^(m-1)*(x-1);
  24. plot (x,f3,'b',x,fa3,'bo');
  25. text (1.8,5.5,'m=3')
  26.  
  27. m=4;
  28. f4=x.^m;
  29. fa4=f4(1)+m*1^(m-1)*(x-1);
  30. plot (x,f4,'y',x,fa4,'yo');
  31. text (1.8,7.5,'m=4')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement