- #1
Zaragoza_S
- 1
- 0
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.
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.