Taylor's Method of Order 2.

The Taylor series method is a numerical method for solving differential equations
18 Downloads
Updated 16 Mar 2022

View License

%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');

Cite As

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. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0