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)

Réponses (1)

Gifari Zulkarnaen
Gifari Zulkarnaen le 5 Juil 2020

0 votes

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 commentaires

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

Cette question est clôturée.

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by