Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

MATLAB Function Interface Error: Domain error. To compute complex results, make at least one input complex, e.g. 'power(complex(a),b)'.

1 visualización (últimos 30 días)
hi, how can i resolve this error?: Domain error. To compute complex results, make at least one input complex, e.g. 'power(complex(a),b)'. the error seems to be the program line:
h2=(4*sin(el)^2*(G - F*(F^2 + G^2 - 1)^(1/2))^2*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^2)/((F*1i - G)^2*(F^2 + G^2)^2);
h3=(8*sin(el)*(G - F*(F^2 + G^2 - 1)^(1/2))*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^2)/((F*1i - G)^2*(F^2 + G^2));
h4=(sin(el)*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^2*1i)/(F*1i - G)^2;
a=-log(((F^2 + G^2)^2*(h1*1i + (2*(1 + (F^2 + G^2 - 1)^(1/2)*1i)*1i)/(F*1i - G) - ((4*(1 + (F^2 + G^2 - 1)^(1/2) * 1i)^2)/(F*1i - G)^2 + X2^2 + X3^2 - (2*X2^2*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^2)/(F*1i - G)^2 +(X2^2*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^4)/(F*1i - G)^4 - (2*X3^2*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^2)/(F*1i - G)^2 + (X3^2*(1 + (F^2 + G^2 - 1)^(1/2)*1i)^4)/(F*1i - G)^4 + h2 - h3)^(1/2)*1i + h4))/(2*(G + F*1i)^2*(X2 - X3*1i)*(1 - G^2 + F*G*1i + (F^2 + G^2 - 1)^(1/2)*1i)))*1i;
  3 comentarios
studentU
studentU el 21 de Mayo de 2015
[I am confused now. Is this in Simulink or is this at the MATLAB command prompt? If it is at the MATLAB command prompt, then I need to a current copy of the line that failed and I need to know the values it fails on -- a sample el, F, G] by Roberson
At the command prompt it's run very well, I remember u that F and G are scalar numeric values, you can take to F = -0, 883, and G = 0.0987, the result is complex format.
but, I'm working in simulink, in matlab function block, where I am blocked, and where it generates this error :/
studentU
studentU el 21 de Mayo de 2015
i think, the solution is to introduce complex() in the h2, h3 h4 and a expressions,
but I can not do it

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by