Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
angle of complex variable

Subject: angle of complex variable

From: Gagandeep Singh Khurana

Date: 20 Mar, 2012 12:16:16

Message: 1 of 3

i'm new at matlab. i'm facing a problem with getting the angle/phase of complex variable.
the program is given as follows. i have to find the phase of p and then differentiate it and then plot Tap. the program is not showing any graph and when observed in steps Thp is coming in complex form. please help me. thanxs in advance.


L=1*(10^7);
lmD=1550;
v=1;
neff=1.45;
Sneff=1*(10^(-4));
c=3*(10^17);
lm=sym ('lm','real');
k=(pi.*v.*Sneff)./lm;
sigc=2.*pi.*neff.*((1./lm)-(1./lmD))+(2.*pi.*Sneff./lm);
y=sqrt((k.^2)-(sigc.^2));
p=-(k.*sinh(y.*L))/(sigc.*sinh(y.*L)+(y.*cosh(y.*L))*i);
Thp=angle(p);
DifThp=diff(Thp,lm);
Tap=-(lm.^2/(2.*pi.*c)).*DifThp;
ezplot(Tap,[1549.5:.01:1551])

Subject: angle of complex variable

From: Nasser M. Abbasi

Date: 20 Mar, 2012 12:41:05

Message: 2 of 3

On 3/20/2012 7:16 AM, Gagandeep Singh Khurana wrote:
> i'm new at matlab. i'm facing a problem with getting the angle/phase of complex variable.
> the program is given as follows. i have to find the phase of p and then differentiate
>it and then plot Tap. the program is not showing any graph and when observed in steps Thp is coming in complex form. please help me. thanxs in advance.
>
>
> L=1*(10^7);
> lmD=1550;
> v=1;
> neff=1.45;
> Sneff=1*(10^(-4));
> c=3*(10^17);
> lm=sym ('lm','real');
> k=(pi.*v.*Sneff)./lm;
> sigc=2.*pi.*neff.*((1./lm)-(1./lmD))+(2.*pi.*Sneff./lm);
> y=sqrt((k.^2)-(sigc.^2));
> p=-(k.*sinh(y.*L))/(sigc.*sinh(y.*L)+(y.*cosh(y.*L))*i);
> Thp=angle(p);

you can not do the above. lm is a symbol and has no value.

may be you meant to write tan(p) instead?

> DifThp=diff(Thp,lm);
> Tap=-(lm.^2/(2.*pi.*c)).*DifThp;
> ezplot(Tap,[1549.5:.01:1551])

You can't ezplot an expression with symbols in it that has
no value. Your 'lm' remains unbounded in all of the above.

You might want to assign a numerical value to it at one
point. Using something like

Tap=subs(Tap,lm,999);


--Nasser

Subject: angle of complex variable

From: Christopher Creutzig

Date: 29 Mar, 2012 06:58:12

Message: 3 of 3

On 20.03.12 13:16, Gagandeep Singh Khurana wrote:
> i'm new at matlab. i'm facing a problem with getting the angle/phase of complex variable.
> the program is given as follows. i have to find the phase of p and then differentiate it and then plot Tap. the program is not showing any graph and when observed in steps Thp is coming in complex form. please help me. thanxs in advance.
>
>
> L=1*(10^7);
> lmD=1550;
> v=1;
> neff=1.45;
> Sneff=1*(10^(-4));
> c=3*(10^17);
> lm=sym ('lm','real');
> k=(pi.*v.*Sneff)./lm;
> sigc=2.*pi.*neff.*((1./lm)-(1./lmD))+(2.*pi.*Sneff./lm);
> y=sqrt((k.^2)-(sigc.^2));
> p=-(k.*sinh(y.*L))/(sigc.*sinh(y.*L)+(y.*cosh(y.*L))*i);
> Thp=angle(p);

angle is currently not defined for sym input. As a workaround, try

Thp = feval(symengine, 'arg', p);

> DifThp=diff(Thp,lm);
> Tap=-(lm.^2/(2.*pi.*c)).*DifThp;
> ezplot(Tap,[1549.5:.01:1551])


HTH,

Christopher

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us