- F is not defined in the ode function
- Either change tv to t or the other way around. Same applies for Y
NOT ENOUGH INPUT ARGUMENTS
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi everyone, I'm trying to solve a system of 5 ODEs with intial conditions using ode45. I'm getting the error message of "Not enough input arguments". I've tried looking up what that means, but I'm still confused. If anyone could help me out with this, that would be great!
This is the main body (saved as ode.m)
function f = ode(t,Y); r=0.2; M=300;
aa=1;
muf=5; aact=1; af=1; mu1=0.1; mu2=0.5; lam = 0.23; tau = 0.36; f=zeros(5,1); f(1,1) = r*Y(1)*(1-Y(1))-lam*Y(1)*Y(2)-aa*Y(5)*Y(1); f(2,1) = lam*Y(1)*Y(2) - muf*F-af*Y(4)*Y(2)-aa*Y(5)*Y(2); f(3,1) = Y(3)*(1-Y(3))-aact*Y(3)*Y(2); f(4,1) = aact*Y(3)*Y(2) - Y(4)*(mu1+tau); f(5,1) = tau*Y(4)-mu2*Y(5); end
And this is the execution script
clear all close all clc
[tv,Yv]=ode45(@ode,[0 1],[0 1 0]); plot(t,Y(:,1),t,Y(:,2),t,Y(:,3),t,Y(:,4),t,Y(:,5))
Thank you
댓글 수: 0
답변 (1개)
Mischa Kim
2015년 4월 29일
편집: Mischa Kim
2015년 4월 29일
JK, your ode call says that the state vector has only three components
[tv,Yv] = ode45(@ode,[0 1],[0 1 0]);
whereas the ode file says that there are five:
f(5,1) = tau*Y(4)-mu2*Y(5);
In addition:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!