%kodi matlabik i serise se teilorit dhe krahasimi i tij me metoden teorike
clc;
clear all;
f = @(t,y) (y-log(t)-2);
fprim=@(t,y) (y-log(t)-2-1/t); % y'=f=y-log(t)-2, f'=y'-1/t+0 =y-log(t)-2-1/t.
a = input('Shkruani fillimin e intervalit, a: ');
b = input('Shkruani fundin e intervalit, b: ');
n = input('Shkruani numrin e nenintervaleve, n: '); %a;h;b
ya = input('Shkruani kushrin fillerstar, ya: ');
h = (b-a)/n;
t=[a zeros(1,n)];
z=[ya zeros(1,n)];
for i = 1:n+1
t(i+1)=t(i)+h;
zprim=f(t(i),z(i))+(h/2)*fprim(t(i),z(i));
z(i+1)=z(i)+h*zprim;
fprintf('%5.4f %11.8f\n', t(i), z(i));
plot(t(i),z(i),'r*-');
grid on;
hold on;
xlabel('t vlera'); ylabel('z vlera');
hold on;
end
syms x y(t);
f= y-log(t)-2;
Dy=diff(y);
ypde=dsolve(Dy== f,'t');
yvde=dsolve(Dy== f,y(a)==ya,'t');
t=linspace(a,b,n);
ysakt=eval(yvde);
plot(t,ysakt,'o-k');
인용 양식
skerdi hymeraj (2024). Taylor's Method of Order 2. (https://www.mathworks.com/matlabcentral/fileexchange/108084-taylor-s-method-of-order-2), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
개발 환경:
R2022a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.0.0 |