MATLAB Help

  • MATLAB
  • Thread starter morry
  • Start date
  • #1
136
0

Main Question or Discussion Point

Ok, so Ive 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.
 

Answers and Replies

  • #2
Tide
Science Advisor
Homework Helper
3,076
0
Should that be 2*pi?
 
  • #3
136
0
Thanks Tide. I must still be doing something wrong.

The graph is archimedes spiral. r= theta

Heres what Ive 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.
 
  • #4
Tide
Science Advisor
Homework Helper
3,076
0
You need to find the element of arc length along the curve. This should help:

[tex]ds = \sqrt {dr^2 + r^2 d\theta^2}[/tex]

which you can easily integrate.
 
  • #5
136
0
Thanks Tide. Im 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.
 
  • #6
Tide
Science Advisor
Homework Helper
3,076
0
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)"
 
  • #7
136
0
Thanks for the help again Tide, I think Ive got it all out! Finally!
 

Related Threads on MATLAB Help

  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
3
Views
4K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
9
Views
3K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
6
Views
2K
Top