ode4 gives variable undefined error
古いコメントを表示
I am trying to use a fixed step solver, such as ODE4 to calculate a value after a fixed time step, however, I am getting stuck on a very basic point. I have to pass F to the ode solver however, obviously because it is an ode, I have the variable that I need to find in F so it is giving me " variable undefined" error. This error is obvious to me but is there a way around it?
I am using the following function from mathworks - ode4 . Please find the code in the functions tab.
And my function calling statement is -
t = linspace(1,10)
vp(1) = 5 %some constant that changes in the loop below
for i = 1: length(t)
v = ode4((v - vf), t(i), 1, t(i+1),vp(1));
vp(1) = 45; % some updated value ( I've chosen a random number for the time being)
end
%error displayed
% -->> Undefined function or variable 'v'.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!