matlab code which works on 2022a is not working in 2023b
syms x y(x)
y1 = x-y^2
%define the function
%define the initial values
x0 = 0
y0 = 1
X = 0.2
h = 0.1
% differentiating successively
y2 = (diff(y1))
y3 = diff(y2)
y4 = diff(y3)
% differentiating order successively
f1=(diff(y1,x,1))
f2=diff(y1,x,2)
f3=diff(y,x,3)
% substitution of values
y10 = subs(y1,{x,y(x)},[x0,y0])
y20 = (subs(y2,{x,y(x),f1},[x0,y0,y10]))
y30 = (subs(y3,{x,y(x),f1,f2},[x0,y0,y10,y20]))
y40 = (subs(y4,{x,y(x),f1,f2,f3},[x0,y0,y10,y20,y30]))
%calculating Taylor series formula
for i=x0+h:h:X
y = y0 + (x-x0)*y10 + (((x-x0)^2)/2)*y20 + (((x-x0)^3)/6)*y30 + (((x-x0)^4)/24)*y40
Y = subs(y,x,i);
fprintf(‘Value of y at x=%0.1f is %.4fn’,i,Y)
endsyms x y(x)
y1 = x-y^2
%define the function
%define the initial values
x0 = 0
y0 = 1
X = 0.2
h = 0.1
% differentiating successively
y2 = (diff(y1))
y3 = diff(y2)
y4 = diff(y3)
% differentiating order successively
f1=(diff(y1,x,1))
f2=diff(y1,x,2)
f3=diff(y,x,3)
% substitution of values
y10 = subs(y1,{x,y(x)},[x0,y0])
y20 = (subs(y2,{x,y(x),f1},[x0,y0,y10]))
y30 = (subs(y3,{x,y(x),f1,f2},[x0,y0,y10,y20]))
y40 = (subs(y4,{x,y(x),f1,f2,f3},[x0,y0,y10,y20,y30]))
%calculating Taylor series formula
for i=x0+h:h:X
y = y0 + (x-x0)*y10 + (((x-x0)^2)/2)*y20 + (((x-x0)^3)/6)*y30 + (((x-x0)^4)/24)*y40
Y = subs(y,x,i);
fprintf(‘Value of y at x=%0.1f is %.4fn’,i,Y)
end syms x y(x)
y1 = x-y^2
%define the function
%define the initial values
x0 = 0
y0 = 1
X = 0.2
h = 0.1
% differentiating successively
y2 = (diff(y1))
y3 = diff(y2)
y4 = diff(y3)
% differentiating order successively
f1=(diff(y1,x,1))
f2=diff(y1,x,2)
f3=diff(y,x,3)
% substitution of values
y10 = subs(y1,{x,y(x)},[x0,y0])
y20 = (subs(y2,{x,y(x),f1},[x0,y0,y10]))
y30 = (subs(y3,{x,y(x),f1,f2},[x0,y0,y10,y20]))
y40 = (subs(y4,{x,y(x),f1,f2,f3},[x0,y0,y10,y20,y30]))
%calculating Taylor series formula
for i=x0+h:h:X
y = y0 + (x-x0)*y10 + (((x-x0)^2)/2)*y20 + (((x-x0)^3)/6)*y30 + (((x-x0)^4)/24)*y40
Y = subs(y,x,i);
fprintf(‘Value of y at x=%0.1f is %.4fn’,i,Y)
end taylor series MATLAB Answers — New Questions