Question: How can I plot the derivative of a function?(adsbygoogle = window.adsbygoogle || []).push({});

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.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab Second Derivative Ploting Problem

Can you offer guidance or do you also need help?

**Physics Forums | Science Articles, Homework Help, Discussion**