Sampling Rate Conversion Notes

Embed Size (px)

Citation preview

  • 8/13/2019 Sampling Rate Conversion Notes

    1/16

  • 8/13/2019 Sampling Rate Conversion Notes

    2/16

  • 8/13/2019 Sampling Rate Conversion Notes

    3/16

    Different Sampling Rates

    can be applied for

    transforming an analog signal

    into a discrete one.

    xc(t)

    Sampling Frequency (Fs)

    is the inverse

    of sampling period ,i.e. Fs=1/Ts

    x n = xc n s

    x[n]= xc(n Ts),

    Ts = 2 Ts

    x[n]=xc(nTN)

  • 8/13/2019 Sampling Rate Conversion Notes

    4/16

    Our task is to change the sampling rate

    of a given discrete-time signal

    in a way that respects thesampling thorem

  • 8/13/2019 Sampling Rate Conversion Notes

    5/16

    Reducing the Sampling Rate by an integer factor

    xd [n] = x [n M] = xc (n M Ts)

    A sequence x[n] can be downsampled

    In the same way that in the original discretization

    tha sampling rate should obey

    N

    during the additional sampling step

    Fs/ M > 2 FN

    Hence, low-pass filtering is usually introduced

    to prevent aliasing effects

  • 8/13/2019 Sampling Rate Conversion Notes

    6/16

    Increasing the Sampling Rate by an integer factor

    xi[n] = xc (n Ts) , with s=s/L

    Starting with a given sequence x[n] ,we can increase the rateby predicting intermediate signal values

    The procedure includes the addition of zeros between samples

    and the use of a low-pass filtering to smooth out the discotinuities

  • 8/13/2019 Sampling Rate Conversion Notes

    7/16

    Change Sampling Rate by rational factor

    Using a system that increases the sampling rate

    by a factor I,

    in cascade sonnection with a system that reduces the rateb a factor D

    we can achieve resampling by non-integer factor

  • 8/13/2019 Sampling Rate Conversion Notes

    8/16

  • 8/13/2019 Sampling Rate Conversion Notes

    9/16

    % plot the signal and scale the time-axis

    size(signal); t=1:100000; time=t*(1/Fs);figure(1),subplot(2,1,1),plot(t,signal),xlabel('discrete-time')

    subplot(2,1,2),plot(time,signal),xlabel('sec')

    % Define Heart-Ratefigure(2),plot(time(1:20000),signal(1:20000))

    [tt,dontcare]=ginput(2)

    RRT=tt(2)-tt(1); HeartRate=1/RRT

    >> HeartRate = 1.2635 Hz

  • 8/13/2019 Sampling Rate Conversion Notes

    10/16

    %%%%__________ A : Reducing Sampling Ratehelp downsample

    signal1=signal(1:10000);

    figure(3),subplot(3,1,1),plot(signal1)

    signal2=downsample(signal1,3);subplot(3,1,2),plot(signal2)

    signal3=downsample(signal1,30);subplot(3,1,3),plot(signal3)

    % notice the clipping in the second beat

  • 8/13/2019 Sampling Rate Conversion Notes

    11/16

    %_____ Improvement using Decimate

    signal4= decimate(signal1,40); plot(signal4)% Decimate includes filter for the aliasing problem

  • 8/13/2019 Sampling Rate Conversion Notes

    12/16

    %%%%_______ B : INCREASE Sampling Rate

    signal5= upsample(signal1,2);

    subplot(2,1,1),plot(signal1), subplot(2,1,2),plot(signal5)% NOTICE: zeros are inserted

  • 8/13/2019 Sampling Rate Conversion Notes

    13/16

  • 8/13/2019 Sampling Rate Conversion Notes

    14/16

    %_C: change the rate by a rational factor

    signal7= resample (signal1,3,2);

    subplot(2,1,1),plot(signal1),subplot(2,1,2),plot(signal7)

  • 8/13/2019 Sampling Rate Conversion Notes

    15/16

    % A demo on Filtering ECG-data

    sgolaydemo

    help ecg

  • 8/13/2019 Sampling Rate Conversion Notes

    16/16

    Digoxin Effect

    The morphology of the QRS complex / ST segment is variouslydescribed as either slurred, sagging or scooped and resemblingeither a reverse tick, hockey stick or my personal favourite!

    Salvador "ali#s moustache$