What did I do wrong here?

u0 = 5000;
lambda = 0.03;
pm = 9000;
k = 100;
f = @(p) lambda*p*(1-p/pm)-k
pf = RK4(f,u0,10,100)

답변 (1개)

Gifari Zulkarnaen
Gifari Zulkarnaen 2020년 7월 5일

0 개 추천

In your function RK4 line 8 to 11, you have two inputs for f function while the f function has only one input value, thus "too many input arguments" error occured.

댓글 수: 2

Right. Use
f = @(t,p) lambda.*.p.*(1-p./pm)-k
Zifeng Qiu
Zifeng Qiu 2020년 7월 5일
Thank you very much

이 질문은 마감되었습니다.

질문:

2020년 7월 4일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by