Plotting a Curve in Polar Coordinates Using MATLAB

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 8K views
morry
Messages
136
Reaction score
0
Ok, so I've been given a curve in polar coordinates.

I came up with a parameterisation:
x(t)=rcos(theta)
y(t)=rsin(theta)

But now I have to plot the graph using MATLAB and I have no idea. Theta lies between 0 and 2pi.

This is what I put in and got back in matlab:
>> t=[0:pi/50:2pi]
? t=[0:pi/50:2pi]
|
Error: Missing MATLAB operator.

Cheers.
 
Physics news on Phys.org
Thanks Tide. I must still be doing something wrong.

The graph is archimedes spiral. r= theta

Heres what I've tried to do:

>>syms x y r theta
>>x=r*cos(theta)
>>y=r*sin(theta)
>>ezpolar(x,y)

I only need to plot from theta= 0-->2pi

Im really lost.

Any info on how to do line integrals would also be appreciated.

Thanks again.
 
Thanks Tide. I am not having trouble doing the maths by hand. I can find line integrals no worries by hand its just that I have no idea how to use matlab.
 
morry,

Since [itex]r = \theta[/itex] you just need to evaluate the integral

[tex]\int_{0}^{2\pi} \sqrt{1+\theta^2} d\theta[/tex]

so look for a MatLab command resembling "int(sqrt(1+x^2), x = 0..2pi)"
 
Thanks for the help again Tide, I think I've got it all out! Finally!