Borrar filtros
Borrar filtros

??? Index exceeds matrix dimensions.

1 visualización (últimos 30 días)
MinHyung
MinHyung el 20 de Ag. de 2013
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.

Respuestas (1)

the cyclist
the cyclist el 20 de Ag. de 2013
Editada: the cyclist el 20 de Ag. de 2013
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 comentarios
MinHyung
MinHyung el 20 de Ag. de 2013
Thank you very much! This problem consume my time a lot ㅠㅠ
the cyclist
the cyclist el 20 de Ag. de 2013
I would appreciate it if you "accept" the answer, which may also help someone in the future who seeks a similar solution.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by