Info

この質問は閉じられています。 編集または回答するには再度開いてください。

ODE45 Question Not Enough Input Argument

1 回表示 (過去 30 日間)
Hafizuddin Bin Mohd Lowhim
Hafizuddin Bin Mohd Lowhim 2020 年 5 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello,
Could anyone help why my rhs_trajectory function has Not Enough Input Argument error, please. The rhs_trajectory.m shall receive input from other functions which are thrust_force.m, drag_force.m and mass.m. The drag_force.m shall receive input from density.m function.
function dz = rhs_trajectory(z,g,F,F_d,m,gamma)
x = z(1);
y = z(2);
v_x = z(3);
v_y = z(4);
dx = v_x;
dy = v_y;
dv_x = ((F-F_d)/m)*cos(gamma); %value F,F_d,m shall be sent by thrust_force.m,drag_force.m,mass.m and the the value drag_force shall be dependent on rho from density.m
dv_y = ((F-F_d)/m)*sin(gamma)-g;
dz = [dx; dy; dv_x; dv_y];
end
I attached other mfile for reference. Please enlighten me/

回答 (1 件)

darova
darova 2020 年 5 月 26 日
The problem is in this line
[t, z] = ode45 (@(t, z) rhs_trajectory(z, g),...
[0 tf], z0, opts);
Your rhs_trajectory function has several input paramaters. You are passing only two of them
function dz = rhs_trajectory(z,g,F,F_d,m,gamma)
  2 件のコメント
Hafizuddin Bin Mohd Lowhim
Hafizuddin Bin Mohd Lowhim 2020 年 5 月 27 日
Thank you for that. Now I amend the code as below. The rhs_trajectory has several input and I pass all of them to the ode45.
[t, z] = ode45 (@(t, z) rhs_trajectory(z,g,F,F_d,m,gamma),...
[0 tf], z0, opts);
rhs_rajectory
function dz = rhs_trajectory(z,g,F,F_d,m,gamma)
I don't get the not enough input argument error anymore but all input which are F,F_d,m and gamma are not recognized variables or functions. Even though I have created them in respective functions. For example when I wrote thrust force in Command Window, they know it is a function.
help thurst_force
thurst_force is a function.
F = thurst_force(mdot, Ce)
But I guess I have to ask this in seperate question. But thank you!
darova
darova 2020 年 5 月 27 日
you are welcome

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by