Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

moving difference function in matlab

Asked by Payam Parsinejad

Payam Parsinejad

on 30 Jan 2013
Accepted Answer by Image Analyst

Image Analyst

Hi all, I recorded the skin conductance signal which is n X 2 vector (amplitude, time). In part of signal analysis i have to apply moving-difference function with a difference interval of 50ms.

The signal sampling interval is 100Hz. Hence the interval for difference function includes 5 points.

What i understood is the moving difference function converts every point in my raw signal into the difference between the value of the point and the value of the point located in a given interval before it (50ms).

I am wondering how I can implement this in MATLAB.

Thanks

0 Comments

Payam Parsinejad

Payam Parsinejad

Products

No products are associated with this question.

1 Answer

Answer by Image Analyst

Image Analyst

on 30 Jan 2013
Accepted answer

You can use conv(). Like

kernel = [0 0 0 0 0 1 0 0 0 0 -1];
diffSignal = conv(signal, kernel, 'valid');

1 Comment

Payam Parsinejad

Payam Parsinejad

on 30 Jan 2013

Thanks, my kernel indeed became like this:

kernel = [0 0 0 0 1 0 0 0 0 -1];

Image Analyst

Image Analyst

Contact us