Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. %% 6.uzd Aproksimācija
  2. clear all
  3. a=2;b=1;c=8;
  4.  
  5. xpunk=0:0.1:c;
  6. y=@(t)exp(-t.^2/a+t/b);
  7. k=0;
  8. for x=0:0.1:8
  9. k=k+1;
  10. ypunk(k)=integral(y,0,xpunk(k));
  11. end
  12. for i=1:81
  13. TABULA(i,1)=xpunk(i);
  14. TABULA(i,2)=ypunk(i);
  15. end
  16. TABULA
  17.  
  18. % turpin?jums.Aproksim?cija ar 1.k?rtas polinomu.
  19. p=polyfit(xpunk,ypunk,6);
  20. xaprok=0:0.1:c; yaprok=polyval(p,xaprok);
  21. figure
  22. plot(xpunk,ypunk,'or',xaprok,yaprok,'k','LineWidth',3)
  23. legend('f(x)','polinoms')
  24. ylim([-1 9]);
  25. xlim([-1 9]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement