Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB Help

  1. Jan 17, 2006 #1
    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.
     
  2. jcsd
  3. Jan 17, 2006 #2

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    Should that be 2*pi?
     
  4. Jan 23, 2006 #3
    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.
     
  5. Jan 23, 2006 #4

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  6. Jan 24, 2006 #5
    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.
     
  7. Jan 24, 2006 #6

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    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)"
     
  8. Jan 24, 2006 #7
    Thanks for the help again Tide, I think Ive got it all out! Finally!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: MATLAB Help
  1. MATLAB help (Replies: 9)

  2. MATLAB help (Replies: 2)

  3. MATLAB help (Replies: 0)

  4. MATLAB help (Replies: 7)

  5. Matlab help (Replies: 6)

Loading...