I am given the following second-order ODE and I want to use ode45 and by not creating a function file.
I am given the equation above, a timespan t, and initial y and dy values.
I first set up my dydt into a matrix [y1' y2']"
dydt = [y(2); eps*((y(1)^2) – 1)*y(2) – y(1)]
func= dydt(t,y)
and tried to evaluate such ode45(@func, t, [y0, dy0]), but it gives me an error
I also tried setting it up as just one function:
f = @(y1,y2) eps*((y1^2) – 1)*y2 – y1;
Here, it gives me the error that I am using the same function, which was previously used as a variable:
ode45(@f, t, [y0, dy0])
Help please?
Best Answer