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

Matlab Second Derivative Ploting Problem

  1. Feb 12, 2012 #1
    Question: How can I plot the derivative of a function?

    Following code for problem 5.9 in MatLab by Gilat 4th Ed:

    t=[0:1:20];
    theta=pi*(1-exp(-0.2*t));
    r=20+30*(1-exp(-0.1*t));
    v=diff(theta)
    table=[t' theta' r']
    polar(theta,r)
    polar(theta,v)

    Error message:

    ??? Error using ==> polar at 61
    THETA and RHO must be the same size.

    Error in ==> Prob5_16 at 12
    polar(theta,v)



    I have looked around for what may be the larger issue and it seems that when you use the "diff" function it shortens one dimension of the array (https://www.physicsforums.com/showthread.php?t=55524)

    Any help please? The link provides "an answer" but i don't understand what he means.
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Matlab Second Derivative Ploting Problem
  1. Ploting Graph - Matlab (Replies: 1)

  2. Matlab ploting (Replies: 1)

Loading...