Hi everyone!(adsbygoogle = window.adsbygoogle || []).push({});

I've written a M-file to draw a sawtooth periodic function as below:

function y = sawtooth_w(x)

% We find the period number of every element

% in the input vector

p = 1;

%k = 4;

tn = ceil((x+p)/(2*p));

% and we subtract that corresponding period from

% the base value. We want final values from -1 to 1

y = ((x - tn*2*p) + 2*p)/p*4;

clear, clc, close all

x = -6 : .01 : 6;

y = sawtooth_w(x);

plot(x,y)

axis([0 6 -5 5])

xlabel('\bf{Time(sec)}')

ylabel('\bf{Magnetic flow(Web)}')

now, I want to draw derivative of this function which consists of impulse signals.

i tried to use diff(y,x) to extract the derivative but it didn't work

does anybody has any solution???

**Physics Forums - The Fusion of Science and Community**

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

# Plot diff plot from a periodic function

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Plot diff plot | Date |
---|---|

Plot a stereographic hypercube in a Mac's Grapher.app? | Saturday at 8:22 AM |

Mathematica Errors when plotting but not when evaluating | Mar 13, 2018 |

Mathematica Color Contour Plots | Mar 8, 2018 |

Mathematica Taking forever to plot | Feb 27, 2018 |

Need help setting up diff equation in matlab | Oct 3, 2005 |

**Physics Forums - The Fusion of Science and Community**