Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. >> plot(x, funkcja1(w, x), 'g-')
  2. >> plot(x, funkcja2(w, x),'r-')
  3. >> plot(x, polyval(w, x),'b-')
  4. >> plot(x, (x-1).^10)
  5.  
  6. funkcja1:
  7.  
  8. function o = funkcja1( w, x )
  9. a = 0;
  10. i = length(w);
  11. while i >= 1
  12. a = a + (w(i)*x.^(i-1));
  13. i = i - 1;
  14. end
  15. o = a;
  16. end
  17.  
  18. funkcja2:
  19.  
  20. function o = funkcja2( w, x )
  21. i = length(w);
  22. temp = 0;
  23. while i >= 1
  24. temp = temp.*x+w(i);
  25. i = i - 1;
  26. end
  27. o = temp;
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement