Why plotting the first derivative of my function gets shrinked on its amplitud?

1 view (last 30 days)
x = linspace(-2*pi,2*pi,100); y1 = sin(x); y2 = diff(y1); figure plot(y2);

Answers (1)

Jan
Jan on 25 Sep 2017
Edited: Jan on 25 Sep 2017
What is the derivative of sin(a * t)?
a * cos(a * t)
Try it:
x = linspace(-2*pi, 2*pi, 100);
y1 = sin(x);
y2 = diff(y1);
figure
plot(x, y1, 'r');
hold('on');
plot(x, y2, 'g');
x2 = linspace(-2*pi, 2*pi, 200); % Time with double resolution
y3 = sin(x2);
y4 = diff(y3);
plot(x2, y4, 'b')

Categories

Find more on Animation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!