Need help with plotting ratio of complex variable functions with MATLAB

Status
Not open for further replies.

abbeyromy

Full Member level 4
Joined
Feb 2, 2010
Messages
194
Helped
26
Reputation
50
Reaction score
7
Trophy points
1,298
Location
US
Activity points
2,708
Hey guys..need some help with MATLAB.

I want to draw a graph of magnitude of
(40*cos(x) + i*54.77*sin(x))/(54.77*cos(x) + i*40*sin(x))

where x is x=0i/20:4*pi;

I am just getting a graph for single value and not the complete x domain. Can you help me here?

Please find the attached file for graphs of numerator and denominator seperately.

Thanks for the help!
Hemanshu
 

Attachments

  • Q2.25.doc
    124 KB · Views: 111

If you are interested just in the magnitude regardless to the phase, simply let:

y = abs((40*cos(x) + i*54.77*sin(x))./(54.77*cos(x) + i*40*sin(x)));

then plot(x,y)

You can notice that I've used './' to divide numerator by denominator. This means the division will be done element-by-element and not as a matricial form.
 
hey albbg, thanks for the reply..
Actually I tried .\ and the result was as expected. So what exactly is the difference between ./ and .\
I intend to divide num by denominator only
 

Are you sure the result you obtained is what you expected ? '.\' means left-side division then in your case: Num.\Den = Den./Num
 

Yes albbg,

The graph that I am getting matches with the solution... so thats why I was confused...

Well thanks for your help!
Hemanshu
 

Using simple math, you can write the amplitude as:

y = sqrt[ (a²*cos²(x)+b²*sin²(x)) /(b²*cos²(x)+a²*sin²(x)) ]

where a = 40, b = 54.77.

this means y(0) = a/b ≈ 0.73

if you make the calculation with matlab using './' for x = 0 you will obtain 0.73; using '.\' instead, you will obtain 1.37 that is 1/0.73.

Since the solution (using './') is a sine-like waveform, the inverse will be again a sine-like but shifted along the x axis.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…