フィルターのクリア

function reference file

1 回表示 (過去 30 日間)
Gleb Skljar
Gleb Skljar 2012 年 2 月 25 日
I need to create a function reference file to be used by the following function, where f is the function name, a b lower and upper limit, and num is the number of intervals. I am new to matlab, and do not know how the reference file should be set up. Thanks in advance.
[area] = trapezoidal(f,a,b,num);
dx = (b-a)/num ;
x = a:dx:b;
for i = 1:length(x)
y(i) = f(x(i));
end
for i = 2: length(x) - 1
area = ((y(i)+y(i+1))/2)*dx + ((y(1)+y(2))/2)*dx + ((y(end-1)+y(end))/2)*dx ;
end

回答 (1 件)

Jiro Doke
Jiro Doke 2012 年 2 月 25 日
Read about "Function Handles" here.

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by