Taylor's Method of Order 2.
Versión 1.0.0 (1,46 KB) por
skerdi hymeraj
The Taylor series method is a numerical method for solving differential equations
%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');
Citar como
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. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2022a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0 |