Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% 6.uzd Aproksimācija
- clear all
- a=2;b=1;c=8;
- xpunk=0:0.1:c;
- y=@(t)exp(-t.^2/a+t/b);
- k=0;
- for x=0:0.1:8
- k=k+1;
- ypunk(k)=integral(y,0,xpunk(k));
- end
- for i=1:81
- TABULA(i,1)=xpunk(i);
- TABULA(i,2)=ypunk(i);
- end
- TABULA
- % turpin?jums.Aproksim?cija ar 1.k?rtas polinomu.
- p=polyfit(xpunk,ypunk,6);
- xaprok=0:0.1:c; yaprok=polyval(p,xaprok);
- figure
- plot(xpunk,ypunk,'or',xaprok,yaprok,'k','LineWidth',3)
- legend('f(x)','polinoms')
- ylim([-1 9]);
- xlim([-1 9]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement