Taylor's Method of Order 2.

The Taylor series method is a numerical method for solving differential equations
18 téléchargements
Mise à jour 16 mars 2022

Afficher la licence

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

Citation pour cette source

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. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2022a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Tags Ajouter des tags

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0