# How to convert EyRe and EyIm to Ey magnitude and phase (CST)

Status
Not open for further replies.

#### vincent113

##### Junior Member level 3 Hi all friend,
I have export the data from the simulation to ASCII file(txt) for manual plot on the matlab but the E-field in form of EyRe and EyIm,How to do them for change to magnetude or amplitude and phase??

Vincent113       #### grendhell

##### Member level 1 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

magnitude = sqrt(EyRe^2 + EyIm^2);
phase = atan(EyIm / EyRe);

#### vincent113

##### Junior Member level 3 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

Hi grendhell
Thanks you for your help.But i have another question need you help also.I fi plot the magnetude per your equation provide will get the positive value only.How to manual plot the export file (ASCII) by get the graph swing like sin wave and change per phasor change.

Thanks and Regards,
VINCENT113

#### grendhell

##### Member level 1 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

Hi, in my previous answer there is a small mistake, you should use the atan2 function instead of the atan function.
Magnitude is always positive, to get what you want you have to compute:
real(magnitude*exp(j*phase));
I'm not actually sure if you need or not a minus in the exp argument, probably it depends by the convention used, but you can easily find it out by trying both cases.
Hope this helps

grendhell

#### snkhan

##### Full Member level 6 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

Hello
I am agreed with the equation u mentioned. i have a little question about H-field/Surface current.

If the same equations/method can be applied to surface current. In that case does ampllitude of the current is independent of the phase.

#### grendhell

##### Member level 1 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

I'm not sure if I understood your question.
Anyway surface current and H field are related by:
J = n X H
where n is the vector normal to the surface on which H is.
Hence the amplitude and phase of J are related to amplitude and phase of H.
Let's say the surface is on the xy plane and n is oriented along z. H can be written as ax*Hx + ay*Hy, where ax and ay are the unit vector and Hx and Hy the x and y component of H. Then:
J = n X H = az X (ax*Hx + ay*Hy) = (az X ax*Hx) + (az X ay*Hy) = ay*Hx - ax*Hy
Remember that Hx and Hy can be respectively expressed as hx*exp(jωt) and hy*exp(jωt +φ), so the amplitude and phase of J is related to the amplitude and phase of H.
Hope this helps

grendhell

#### snkhan

##### Full Member level 6 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

I am totally agree with you. Actually when we draw surface current in a simulation software. There are usually two options
1) phase (and we can get the surface current at any phase value e.g 30 or 145)
2) But when we switch to amplitude value of the surface current. In that case one cannot select the phase.

So it seems that when we draw amplitude of the surface current then somehow it becomes independent of the phase of surface current.

#### vincent113

##### Junior Member level 3 Re: How to convert EyRe and EyIm to Ey magnitude and phase (

Hi all friend,
If i calculate them in excel file ,how to put the j in the formula of excel file.

Thanks and Regards,
VINCENT    Status
Not open for further replies.