Hi guys. I have a problem about publishing the ODE45 function and plot.
function dx = HW4_matlab(t,x)
dx = zeros(2,1);
dx(1) = exp(-x(1))-x(2)*t;
dx(2) = x(1)*t+cos(x(1)+x(2));
[t,x] = ode45(@HW4_matlab,[1,5],[10,2]);
When I am going to publish this code, an error shows up:
Unable to perform assignment because the left and right sides have a different number of elements.
Error in HW4_matlab (line 4)
dx(1) = exp(-x(1)) - x(2)*t;
How could I fix it?