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!