error To compute complex results, make at least one input complex, e.g. 'power(complex(a),b)'.

조회 수: 1 (최근 30일)
hi,
i try to run a function when i have:
b = -log(((F - G*1i)*(1 + (F^2 + G^2 - 1)^(1/2)*1i)*1i)/(F^2 + G^2))*1i;
but it's generated,
??? Domain error. To compute complex results, make at least one input complex, e.g.
'power(complex(a),b)'.
how can i resolve it?
  댓글 수: 4
Walter Roberson
Walter Roberson 2015년 5월 21일
Somewhere along the line you sent me a sample F and G value (but not e1.) I explored the graph with those values, and used an arbitrary e1, and I found that your "b" value can come out real or complex depending on the exact values used. When G = 1 there is also a singularity.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2015년 5월 20일
Try
b = -log(((F - G*1i).*(1 + (F.^2 + G.^2 - 1).^(1/2)*1i)*1i)./(F.^2 + G.^2))*1i;
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 5월 20일
I am going to speculate that what might work is
b = -log(((F - G*1i).*(1 + complex(F.^2 + G.^2 - 1).^(1/2)*1i)*1i)./(F.^2 + G.^2))*1i;

댓글을 달려면 로그인하십시오.


studentU
studentU 2015년 5월 20일
편집: Walter Roberson 2015년 5월 21일
i try for:
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);
>> h2= (complex((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);
but i didn't success to do it for:
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 + (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;
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 5월 21일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by