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
