Announcement

Collapse
No announcement yet.

matlab filter properties

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • matlab filter properties

    Hello everyone,

    I have noticed lately that there are a number of members of
    our community who use matlab to filter their position data. In the
    past I have used matlab, specifically the cheby1 option to perform
    these operations, with good results. However, a journal reviewer has
    recently raised a question regarding my methods and it caused me
    to think more closely about matlab's filtering.

    Enclosed is a sample .m file that can be cut and pasted into
    matlab. The data is from an led placed on the leg segment during
    lifting and is sampled at 100 Hz (therefore a Nyquist frequency of
    50). Three different cheby1 filters are defined with cut off
    frequencies of 2 Hz, 2Hz and and seemingly low 0.17 Hz. Now for
    those of you who use matlab, you may know that the cheby1 option also
    requires you to state the dB of ripple in the passband. This has
    been set to either 0.5 (the recommended starting value if you are
    unsure) and 0.0001.

    Let me define...
    Filter 1. Cut off = 2Hz, 0.50 dB ripple in passband.
    Filter 2. Cut off = 2Hz, .00001 dB ripple in the passband.
    Filter 3. Cut off= 0.17 Hz, 0.00001 dB ripple in the passband.

    When you run the matlab file you will see the raw and smoothed
    data for each of these filters, and also the Bode plots. When I
    qualitatively look at the "performanace" of the three filters I judge
    Filter 3 to be superior (cutoff frequency 0.17, .00001 dB
    ripple). Filter 1 shifts the data, while Filter 2 does not
    sufficiently smooth the data.

    The Bode plots show that the actual cut off frequency for Filter 1
    and Filter 3 are approximately 2-3 Hz, and Filter 2 is about 25 Hz.

    I am familiar with the basics of signal processing but am hoping
    someone can shed a bit of light on this curious finding. If you are
    reporting the use of this filter in a manuscript is it appropriate to
    state the cutoff filter from the bode plot, or the software
    specifications. This is the dilema I am in. I have reported a
    cutoff frequency of 0.17 Hz, and it obviously raised some concern,
    but the bode plot shows that this isn't really the case.

    In any event, thank you for reading this and I hope you find it
    interesting. It seems like many people are using this software
    without any mention of this behaviour. I would like to know more.
    Thanks in advance.

    With regards,
    David


    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >

    % 1. Cutoff frequency perscribed as .035/50
    % .00001 dB of Ripple in the passband
    [b,a]=cheby1(2,.5, 2/50)

    % 2. Cutoff frequency perscribed as .035/50
    % .00001 dB of Ripple in the passband
    [d,c]=cheby1(2,.00001, 2/50)

    % 3. Cutoff frequency perscribed as .035/50
    % .00001 dB of Ripple in the passband
    [f,e]=cheby1(2,.00001, 0.17/50)

    x=[
    .114822
    .1146299
    .1150839
    .114484
    .1146179
    .114633
    .1146589
    .1146399
    .1146719
    .1147149
    .1149649
    .113958
    .1139909
    .114163
    .1140569
    .113802
    .1131449
    .1134449
    .1137949
    .1136789
    .1129589
    .11354
    .1131579
    .113164
    .1126179
    .1110199
    .1106
    .110174
    .1096169
    .1091869
    .108957
    .1089249
    .1095219
    .108583
    .1082939
    .1078519
    .1073229
    .107018
    .1075059
    .10689
    .1074089
    .1071169
    .10728
    .107021
    .1064789
    .107816
    .1076579
    .107882
    .1083399
    .1079879
    .108153
    .1087429
    .109526
    .1097259
    .109468
    .1093499
    .1093799
    .110306
    .1103769
    .1104199
    .1104369
    .110917
    .1114089
    .1115589
    .1117549
    .1115039
    .1109289
    .1122789
    .1111689
    .111987
    .110328
    .1110179
    .111331
    .111481
    .1112219
    .1115759
    .111
    .1110299
    .1106539
    .1104049
    .10986
    .1091429
    .107982
    .1080579
    .1071539
    .1073219
    .108611
    .1086179
    .109554
    .109718
    .10966
    .1096829
    .109244
    .1085269
    .1079889
    .107389
    .107582
    .108075
    .109264
    .109883
    .109613
    .1106999
    .1107949
    .1099179
    .1088979
    .1087539
    .108042
    .1077499
    .107137
    .107271
    .106835
    .106981
    .106967
    .1071399
    .106816
    .1063669
    .1066699
    .106968
    .107321
    .1072699
    .107872
    .10819
    .107855
    .1082789
    .1088759
    .109231
    .108415
    .109483
    .10975
    .110206
    .110648
    .111267
    .1114979
    .111676
    .11165
    .112693
    .111905
    .112773
    .113094
    .1136559
    .1136419
    .1136189
    .113591
    .113832
    .114431
    .114577
    .114526
    .1146339
    .1144779
    .1150589
    .116052
    .1160139
    .116605
    .1164209
    .1174309
    .1174869
    .117512
    .1177629
    .118055
    .117677
    .1184279
    .1183589
    .11821
    .11862
    .1179919
    .1184359
    .1180969
    .1180649
    .1186349
    .117835
    .1173539
    .1181339
    .1173499
    .117621
    .1172829
    .116401
    .116607
    .1158619
    .115679
    .1154159
    .114747
    .114725
    .1141289
    .113963
    .113366
    .1127609
    .112387
    .1115309
    .111383
    .111377
    .1106019
    .111322
    .1106179
    .111151
    .1111709
    .1109649
    .1109839
    .1100829
    .110316
    .1104929
    .1101799
    .110759
    .1096799
    .109819
    .110105
    .1099179
    .1103349
    .110036
    .1101929
    .110306
    .1098399
    .109647
    .10948
    .1091369
    .109263
    .108676
    .109716
    .108036
    .1082919
    .107257
    .1067829
    .1057149
    .1048489
    .104102
    .102871
    .103007
    .10215
    .101691
    .1018259
    .101549
    .10065
    .1005159
    9.96640E-02
    9.84770E-02
    9.79070E-02
    9.80570E-02
    9.70340E-02
    9.67660E-02
    9.65890E-02
    9.55700E-02
    9.52850E-02
    9.48550E-02
    9.54420E-02
    9.48640E-02
    9.44030E-02
    9.41390E-02
    9.35640E-02
    9.31330E-02
    9.22800E-02
    9.22880E-02
    9.21110E-02
    9.10890E-02
    9.15140E-02
    9.10670E-02
    9.08170E-02
    9.06580E-02
    9.00690E-02
    8.99380E-02
    9.00860E-02
    8.93470E-02
    8.95000E-02
    8.94770E-02
    8.93440E-02
    8.93320E-02
    9.03580E-02
    8.90460E-02
    8.97630E-02
    8.99150E-02
    9.07620E-02
    9.01880E-02
    9.04950E-02
    9.07830E-02
    9.05000E-02
    9.06760E-02
    9.06470E-02
    9.19690E-02
    9.13770E-02
    9.12410E-02
    9.13900E-02
    9.18170E-02
    9.18170E-02
    9.19770E-02
    9.28490E-02
    9.29950E-02
    9.31220E-02
    9.32750E-02
    9.35840E-02
    9.32900E-02
    9.41360E-02
    9.42760E-02
    9.44330E-02
    9.44220E-02
    9.50050E-02
    9.51570E-02
    9.55790E-02
    9.58830E-02
    9.61510E-02
    9.58670E-02
    9.68810E-02
    9.63190E-02
    9.65940E-02
    9.70540E-02
    9.71700E-02
    9.74630E-02
    9.68810E-02
    9.74630E-02
    9.78900E-02
    9.78880E-02
    9.74340E-02
    9.71450E-02
    9.77410E-02
    9.71370E-02
    9.68510E-02
    9.72660E-02
    9.69720E-02
    9.65300E-02
    9.70810E-02
    9.75370E-02
    9.65030E-02
    9.73720E-02
    9.73530E-02
    9.76450E-02
    9.74640E-02
    9.78890E-02
    9.77360E-02
    9.81580E-02
    9.83230E-02
    9.80200E-02
    9.78550E-02
    9.74130E-02
    9.78660E-02
    9.72630E-02
    9.68410E-02
    9.75320E-02
    9.78260E-02
    9.86840E-02
    9.82480E-02
    9.89760E-02
    9.85050E-02
    9.86680E-02
    9.87960E-02
    9.90950E-02
    9.89600E-02
    9.91150E-02
    9.88080E-02
    9.93650E-02
    9.97790E-02
    9.99430E-02
    .10048

    .10048
    .1012369
    .101222
    .1016279
    .1019449
    .102497
    .102457
    .1031839
    .1036409
    .104497
    .1043379
    .1038919
    .1041729
    .105076
    .1044609
    .1054
    .1056709
    .106178
    .106508
    .107526
    .1067759
    .1066149
    .107342
    .107202
    .1073539
    .1067539
    .106903
    .107494
    .1073529
    .1067009
    .107578
    .1067289
    .107588
    .1079149
    .108027
    .1087599
    .1084209
    .1082929
    .108693
    .108302
    .1087279
    .110177
    .109564
    .1095829
    .1097429
    .1095869
    .1105889
    .1114649
    .111596
    .112199
    .1126179
    ];
    t= 1.00000E-02: 1.00000E-02: 4.0;

    % 1. Cutoff frequency perscribed as .035/50
    % .00001 dB of Ripple in the passband
    % [b,a]=cheby1(2,.5, 2/50)

    % 2. Cutoff frequency perscribed as .035/50
    % .00001 dB of Ripple in the passband
    % [d,c]=cheby1(2,.00001, 2/50)

    % 3. Cutoff frequency perscribed as .035/50
    % .00001 dB of Ripple in the passband
    % [e,f]=cheby1(2,.00001,.0035)

    xba=filtfilt(b,a,x)
    plot (t,x,t,xba)
    title('[b,a]=cheby1(2,.5, 2/50)')
    figure
    freqz(b,a)
    title('[b,a]=cheby1(2,.5, 2/50)')
    figure

    xdc=filtfilt(d,c,x)
    plot(t,x,t,xdc)
    title('[d,c]=cheby1(2,.00001, 2/50)')
    figure
    freqz(d,c)
    title('[d,c]=cheby1(2,.00001, 2/50)')
    figure

    xfe=filtfilt(f,e,x)
    plot(t,x,t,xfe)
    title('[e,f]=cheby1(2,.00001, 0.17/50)')
    figure

    freqz(f,e)
    title('[e,f]=cheby1(2,.00001, 0.17/50)')

    Department of Rehabilitation Sciences
    University of East London
    Romford Road
    London E15 4LZ
    Phone 0181-590-7000 (4025)
    d.m.hooper@uel.ac.uk

    -------------------------------------------------------------------
    To unsubscribe send UNSUBSCRIBE BIOMCH-L to LISTSERV@nic.surfnet.nl
    For more information: http://www.kin.ucalgary.ca/isb/biomch-l.html
    -------------------------------------------------------------------
Working...
X