Plotting Derivative of data in matlab - Stack Overflow
stackoverflow.com › questions › 27948140Jan 14, 2015 · S.t is the time vector and S.I is the current vector in each time in S.t . (both should be in the same length N ). Now, if you want to approximate the derivative: dt = diff (S.t); % dt is the time intervals length, dt is N-1 length. dI = diff (S.I); derivative = dI./dt; %derivative is memberwise division of dI by dt plot (t (1:end-1),derivative); % when you plot both vector should be in the same length: % t (1:end-1) is the same as t except the last coordinate.