matlab give me error

2 views (last 30 days)
raffaele orlando
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
raffaele orlando
raffaele orlando on 16 Mar 2020
Not enough input arguments.
Error in altezza (line 2)
hdot = -(0.0334*sqrt(h))/(10*h-h^2);
this is the error message

Sign in to comment.

Accepted Answer

Ameer Hamza
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

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!