フィルターのクリア

"Undefined function 'rk' for input arguments of type 'inline'." error

2 ビュー (過去 30 日間)
ZhenQi
ZhenQi 2012 年 12 月 4 日
function r = rk(a, b, h, f)
n = (b-a)/h;
t = a;
w = 1/3;
for i = 1:n
kone = h * f(t,w);
ktwo = h * f(t+h/2,w+kone/2);
kthr = h * f(t+h/2,w+ktwo/2);
kfou = h * f(t+h,w+kthr);
w = w + (kone + 2*ktwo + 2*kthr + kfou)/6;
t = a + i*h;
fprintf('w=%f t=%f\n',w,t);
end
r = 0;
why does it always give me an error? my other function has exactly the same structure as this one and it works!!!!

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 4 日
Make sure that this is stored in rk.m and that the file is on your MATLAB path. Use
which -all rk
to see if it is on your path.
  7 件のコメント
ZhenQi
ZhenQi 2012 年 12 月 4 日
haha ok now this is interesting.
i went into the path folder using the windows explorer, and NOTHING is there! not even the file that DOES work is there. is it hidden? how can this be! and i tried to open it again using matlab File->open->bla bla bla->rk and it IS there.
ZhenQi
ZhenQi 2012 年 12 月 4 日
oh thank you i got it to work for some reason i quit the program, came back in, reassigned the folder path to what i had before and i magically works now

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by