MATLAB: How to fix the code for ode45

errorode45

function_handle with value:
@(x,y)'(9*14^(1/2)*exp(-(2*x)/9)*sin((14^(1/2)*x)/9))/7)'
>> [x,y]=ode45(f,[0,25],0)
Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
this is my ode45 code
[x,y] = ode45(odefun,xspan,y0)
[x,y] = ode45(odefun,xspan,y0,options)
[x,y,xe,ye,ie] = ode45(odefun,xspan,y0,options)
sol = ode45(___)

Best Answer

Delete the single quotation marks.
This runs without error:
f = @(x,y) (9*14^(1/2)*exp(-(2*x)/9)*sin((14^(1/2)*x)/9))/7;
[x,y]= ode45(f,[0,25],0)
figure
plot(x, y)
grid
.
Related Question