Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Problem to extract real and imaginary parts?

조회 수: 1 (최근 30일)
Ivan
Ivan 2019년 10월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
syms E0 real positive
syms x real
syms y real
syms z real
syms x0 real
syms y0 real
syms z0 real
syms R real positive
syms e0 real positive
syms ew real positive
syms er real
syms ei real positive
syms kn real positive
rk=[x;y;z]; %vector
r0=[x0;y0;(z0+R)]; %vector
Eplx=0;Eply=0;Eplz=E0;
em=er+ei*1i;
a0=4*pi*R^3*((em-ew)/(em+2*ew));
px=ew*e0*a0*Eplx;
py=ew*e0*a0*Eply;
pz=ew*e0*a0*Eplz;
p=[px;py;pz];
E1=kn^2.*cross((rk-r0),cross(p,(rk-r0))).*exp(1i*kn*norm(rk-r0))./((norm(rk-r0)).^3);
E2=((1-1i*kn*norm(rk-r0))./(norm(rk-r0).^2)).*(3*(rk-r0).*dot((rk-r0),p)-(n.^2.*p)).*exp(1i*kn*norm(rk-r0))./((norm(rk-r0)).^3);
It is not possible to extract real and imag parts from E1 and E2. Where can be the problem? How can it be solved? Is it too complex for Matlab to recognize Re and Im parts in such expression?
Thank you!
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 10월 28일
n is undefined in the final line.
Ivan
Ivan 2019년 10월 28일
the problem remains still.. even if I substitute n=norm(rk-r0)

답변 (1개)

Walter Roberson
Walter Roberson 2019년 10월 28일
rewrite( expand(E1), 'sincos' )
and you might want to simplify() afterwards.

이 질문은 마감되었습니다.

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by