Can someone explain why I keep getting an error in MatLab on the bolded line. Its in the function y-Y(i)+h*(y-y.^2 + 1.14*cos(exp(t/2)) . I have…

Can someone explain why I keep getting an error in MatLab on the bolded line. Its in the function y-Y(i)+h*(y-y.^2 + 1.14*cos(exp(t/2)) . I have tried everything. Thank you 🙂

%Eulers Improved

%y’=y-y^2+1.14*cos(exp(1)^(t/2)

y0=-.5;

t0=0;

tEnd=20;

h=1/32;

N=(tEnd-t0)/h;

%%Initialize Solutions

T= [0:h:tEnd]’;

Y=zeros(N+1,1);

Y(1)=y0;

%%Solve using Eulers Improved Method

for i=1:N

  t=T(i)+h;

  y= f..(@(y)  y-Y(i)+h*(y-y.^2 + 1.14*cos(exp(t/2)), Y(i);

  T(i+1) = t;

  Y(i+1)=y;

end

%%Plot 

plot(T,Y);

Place this order or similar order and get an amazing discount. USE Discount “GET12” for 12%

Posted in Uncategorized