integrad function not returning an output vector of the same length as the input vector

1 回表示 (過去 30 日間)
Amy
Amy 2014 年 3 月 15 日
コメント済み: Amy 2014 年 3 月 15 日
I have the following function
function x = rZSum(y, z)
y = load('delta.txt');
z = load('aSqr.txt');
x = y./z;
format long e
end
This returns a double workspace variable
I want to integrate this between 0 and 0.9999
I have tried using
Q = quadl(@rZSum,0,0.9999)
and
Q = quad(@rZSum,0,0.9999)
with the following error being returned:
Error using quad (line 75)
The integrand function must return an output vector of the same length as the input
vector.
Im unsure of why this error is happening?
Thankyou for any help in advanced!
  2 件のコメント
Star Strider
Star Strider 2014 年 3 月 15 日
編集済み: Star Strider 2014 年 3 月 15 日
Use trapz or cumtrapz in your application.
Amy
Amy 2014 年 3 月 15 日
I have tried to use both with the following error being returned:
Error using diff
Function 'diff' is not supported for class 'function_handle'.
? Im new to using numerical integration so any help is appreciated thank you

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by