フィルターのクリア

??? Index exceeds matrix dimensions.

1 回表示 (過去 30 日間)
MinHyung
MinHyung 2013 年 8 月 20 日
I tried to use function 'quad' but failed...
>> quad (@(phi) (224 - 32*sin(7) + 32*cos((7.*cos(phi))./2).^2.*sin(7) + 32*cos((7.*sin(phi))./2).^2.*sin(7) - 224*cos((7*cos(phi))./2).^2 - 224*cos((7*sin(phi))./2).^2 - 32*cos((7*cos(phi))./2).^2.*cos((7*sin(phi))./2).^2.*sin(7) + 224*cos((7*cos(phi))./2).^2.*cos((7*sin(phi))./2).^2)/(823543.*cos(phi).^2 - 823543*cos(phi).^4), 0.1,pi/2-0.1)
??? Index exceeds matrix dimensions.
Error in ==> quad at 85
if ~isfinite(y(7))
--------------------------------------------------------------------
'quad' with separate part works well
this part :
(224 - 32*sin(7) + 32*cos((7.*cos(phi))./2).^2.*sin(7) + 32*cos((7.*sin(phi))./2).^2.*sin(7) - 224*cos((7*cos(phi))./2).^2 - 224*cos((7*sin(phi))./2).^2 - 32*cos((7*cos(phi))./2).^2.*cos((7*sin(phi))./2).^2.*sin(7) + 224*cos((7*cos(phi))./2).^2.*cos((7*sin(phi))./2).^2)
and this part :
(823543.*cos(phi).^2 - 823543*cos(phi).^4
Is there anyone who knows this reason?
Thank you very much in advance.

回答 (1 件)

the cyclist
the cyclist 2013 年 8 月 20 日
編集済み: the cyclist 2013 年 8 月 20 日
Do you get what you expect if you use "./" instead of just "/" for the division of your two terms?
This code works for me:
f1 = @(phi) (823543.*cos(phi).^2 - 823543*cos(phi).^4);
f2 = @(phi) (224 - 32*sin(7) + 32*cos((7.*cos(phi))./2).^2.*sin(7) + 32*cos((7.*sin(phi))./2).^2.*sin(7) - 224*cos((7*cos(phi))./2).^2 - 224*cos((7*sin(phi))./2).^2 - 32*cos((7*cos(phi))./2).^2.*cos((7*sin(phi))./2).^2.*sin(7) + 224*cos((7*cos(phi))./2).^2.*cos((7*sin(phi))./2).^2);
f3 = @(phi) f2(phi)./f1(phi);
quad(f3,0.1,pi/2-0.1)
  2 件のコメント
MinHyung
MinHyung 2013 年 8 月 20 日
Thank you very much! This problem consume my time a lot ㅠㅠ
the cyclist
the cyclist 2013 年 8 月 20 日
I would appreciate it if you "accept" the answer, which may also help someone in the future who seeks a similar solution.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by