Plotting a Curve in Polar Coordinates Using MATLAB

Click For Summary
SUMMARY

The discussion focuses on plotting a curve in polar coordinates using MATLAB, specifically an Archimedes spiral defined by the parameterization r = θ. The user initially encounters syntax errors due to incorrect MATLAB commands, such as using "2pi" instead of "2*pi". The correct approach involves defining the polar coordinates with the equations x(t) = r*cos(θ) and y(t) = r*sin(θ), and utilizing the MATLAB function ezpolar for plotting. Additionally, the discussion touches on calculating line integrals along the curve using the integral command in MATLAB.

PREREQUISITES
  • Understanding of polar coordinates and their parameterization
  • Familiarity with MATLAB syntax and functions
  • Basic knowledge of calculus, specifically line integrals
  • Experience with MATLAB symbolic math toolbox
NEXT STEPS
  • Learn how to use the MATLAB ezpolar function for plotting polar curves
  • Research MATLAB syntax for defining variables and functions
  • Explore the MATLAB symbolic toolbox for performing integrals
  • Study the concept of arc length in polar coordinates and its integration
USEFUL FOR

This discussion is beneficial for students and professionals in mathematics, engineering, and computer science who are working with polar coordinates and need to visualize curves using MATLAB.

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
Should that be 2*pi?
 
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.
 
You need to find the element of arc length along the curve. This should help:

ds = \sqrt {dr^2 + r^2 d\theta^2}

which you can easily integrate.
 
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 r = \theta you just need to evaluate the integral

\int_{0}^{2\pi} \sqrt{1+\theta^2} d\theta

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!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K