フィルターのクリア

matrix dimension problem with integral

1 回表示 (過去 30 日間)
Shan  Chu
Shan Chu 2017 年 8 月 16 日
編集済み: Torsten 2017 年 8 月 17 日
Dear all,
I have devloped this code and don't think there is any problem with is. However, Matlab returned an error on the matrix dimensions but I didn't use an array.
Could you please help? I also attached the file for the function expression.
Thanks
Ra_i=10.5e-3;
Ra_o=11.5e-3;
l1=1e-3;
mu=4*pi*1e-7;
n1=1;
A=@(x) integral(@(y) y.*besselj(1,x.*y),Ra_i,Ra_o);
fun_M=@(alp,gam) (gam.*(A(gam)).^2.*(sin(alp.*l1/2)).^2)./(alp.^2.*(alp.^2+gam.^2))
L=8*mu.*n1.*integral2(fun_M,0,Inf,0,Inf,'AbsTol', 1e-12,'RelTol',1e-12);

採用された回答

Torsten
Torsten 2017 年 8 月 16 日
A=@(x) integral(@(y) y.*besselj(1,x.*y),Ra_i,Ra_o,'ArrayValued',true);
Best wishes
Torsten.
  2 件のコメント
Shan  Chu
Shan Chu 2017 年 8 月 16 日
Thank you so much. it works Could you please explain why we need to assign this as an array?
Torsten
Torsten 2017 年 8 月 17 日
編集済み: Torsten 2017 年 8 月 17 日
Take a look at the example "Vector-Valued Function" under
https://de.mathworks.com/help/matlab/ref/integral.html
Note that "gam" from integral2 will be a vector. So in order to calculate A(gam), you will have to activate the "ArrayValued=true" option.
Best wishes
Torsten.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by