user559096
user559096

Reputation: 107

Drawing the derivative of a curve

I have a 3D curve in MATLAB, now I want to draw the derivative of that curve in another graph?
For example, for y = x2 the derivative w.r.t. x is y = 2x.

How can I do this ?

Upvotes: 0

Views: 4429

Answers (1)

Nasser
Nasser

Reputation: 13141

I do not understand the '3D' part. Why is y=x^2 a 3D curve?

But if you want to plot y=x^2 and its derivative on the same plot, use ezplot

clear all; close all;
syms x 
y=x^2;
h=ezplot(y,[-6,6]);
set(h, 'Color', 'r'); 
hold on;
ezplot(diff(y,x),[-6,6]);

enter image description here

Upvotes: 4

Related Questions