%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 (2025). 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 |