function [T,Y] = taylor(f,a,b,ya,m)
syms t y
dfs(1) = symfun(f, [t y]);
for k=1:3
dfs(k+1) = diff(dfs(k),t)+f*diff(dfs(k),y);
end
df = matlabFunction(symfun(dfs,[t y]));
h = (b - a)/m;
T = zeros(1,m+1);
Y = zeros(1,m+1);
T(1) = a;
Y(1) = ya;
for j=1:m
tj = T(j);
yj = Y(j);
D = df(tj,yj);
Y(j+1) = yj + h*(D(1)+h*(D(2)/2+h*(D(3)/6+h*D(4)/24)));
T(j+1) = a + h*j;
end
end
and i m solving f=y-t^2+1
1 Comment
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/315365-too-many-output-arguments-why-i-am-getting-this-issue#comment_411343
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/315365-too-many-output-arguments-why-i-am-getting-this-issue#comment_411343
Sign in to comment.