I am trying to solve hindmarsh rose equation and i wrote the function for it.. But, as i plot the equation using ode45. i am getting error. I tried using ode15s but, it gives same error. Attached is my code along with the error.
이전 댓글 표시
I am trying to solve hindmarsh rose equation and i wrote the function for it.. But, as i plot the equation using ode45. i am getting error. I tried using ode15s but, it gives same error. Attached is my code along with the error.
Function:
function F = hindmarsh_rose(x,u) %function
F = zeros(3,1);
X=x(1);
Y=x(2);
Z=x(3);
F = [Y-X.^3+3*X.^2-Z+u;1-5*X.^2-Y;0.001*(4*(X-(-1.618))-Z)]; %equations
end
Code:
u =0:0.01:5; %range for u
x0 = [0.1,0.1,0.1]; %initial values
tspan= [0 25]; %time span
[t,x] = ode15s(@(t,x) hindmarsh_rose(x,u), tspan, x0); %using ode15
plot(t,x);
Error:
>> try1
Error using hindmarsh_rose (line 2)
Not enough input arguments.
Error in @(t,x)hindmarsh_rose
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 148)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in try1 (line 4)
[t,x] = ode15s(@(t,x) hindmarsh_rose, tspan, x0);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!