To attempt and solve a problem. This is my code:

%pdb.m
function dydx = pdb(x,y)
dydx=(-2*x^3)+(12*x^2)-(20*x)+(8.5);
%runpdb.m
clear
clc
rentang_x = [0 4];
y0 = 1;
[x,y] = ode23('pdb',rentang_x,y0);
plot(x,y)
xlabel('x')
ylabel('y')
the error is
Error using pdb (line 3)
Not enough input arguments.

 採用された回答

Adam
Adam 2015 年 6 月 2 日

0 投票

How are you running your code?
That is a function that takes arguments, not a script, so you must call it from the command line (or another script/function/class) passing arguments into it as e.g.
pdb( 6, 7 );
rather than just clicking 'Run' on the .m file.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

タグ

質問済み:

2015 年 6 月 2 日

回答済み:

2015 年 6 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by