## How to plot the dervative of a curve

### ayat (view profile)

on 15 Feb 2013

Hi, I am very new to Matlab so apologies in advance! I have two columns of numbers which I have used for plotting a simple x-y curve. Now I need to have the derivate of this curve. So it would be like dx/dy for Y axis.

Jan Simon

### Jan Simon (view profile)

on 15 Feb 2013

When you post the code (or an example code) for "I have two columns of numbers", it would be much easier to create an answer. Obviously Azzi fails to guess the names of the variables you use, and you fail to transfer his suggestion to you real application.

## Products

No products are associated with this question.

### Azzi Abdelmalek (view profile)

on 15 Feb 2013

For example

```X=0:0.1:10   % Your x-axis
dY=diff(Y)./diff(X)
hold on
```

Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 15 Feb 2013
` Maybe it's a bad idea`
Image Analyst

### Image Analyst (view profile)

on 15 Feb 2013

Let's quit wasting time. ayat, upload your data somewhere - your favorite web site. Tell us the URL, and the code you used to read in the data file, so we can give you code that uses your exact data. Azzi's example was correct - you obviously changed something in it. You probably have a huge derivative because at some point(s) your curve turns almost vertical.

ayat

### ayat (view profile)

on 16 Feb 2013

ok, here is the basic x-y I have:

http://www.mediafire.com/?2cqugy3ja1vn5pn

So I need the change in the slope of this data plotted as a new curve. If you could give me the code that would do that I would really be grateful!

#### Join the 15-year community celebration.

Play games and win prizes!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi