matlab give me error
2 views (last 30 days)
Show older comments
raffaele orlando
on 16 Mar 2020
Edited: Ameer Hamza
on 16 Mar 2020
function hdot = height(t,h)
hdot = -(0.0334*sqrt(h))/(10*h-h^2);
[t, h] = ode45 (@height, [0 2475], 9);
plot(t,h),xlabel('Time (sec)'),ylabel('Height (ft)')
end
5 Comments
Accepted Answer
Ameer Hamza
on 16 Mar 2020
Edited: Ameer Hamza
on 16 Mar 2020
You need to move the ode45 and plot statements out of the function. Run it like this
[t, h] = ode45 (@height, [0 2475], 9);
plot(t,h)
xlabel('Time (sec)')
ylabel('Height (ft)')
function hdot = height(t,h)
hdot = -(0.0334*sqrt(h))/(10*h-h^2);
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!