필터 지우기
필터 지우기

??? 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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by