-
Notifications
You must be signed in to change notification settings - Fork 2
/
EMGfilter_lp300.m
72 lines (62 loc) · 3.3 KB
/
EMGfilter_lp300.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function y = EMGfilter_lp300(x)
%EMGFILTER_LP300 Filters input x and returns output y.
% MATLAB Code
% Generated by MATLAB(R) 9.5 and 0.1.3 DSP System Toolbox.Generated by MATLAB(R) 9.7 and
% Generated on: 05-Mar-2024 05:02:09
%#codegen
% To generate C/C++ code from this function use the codegen command. Type
% 'help codegen' for more information.
persistent Hd;
if isempty(Hd)
% The following code was used to design the filter coefficients:
% % FIR Window Lowpass filter designed using the FIR1 function.
%
% % All frequency values are in Hz.
% Fs = 32000; % Sampling Frequency
%
% N = 100; % Order
% Fc = 300; % Cutoff Frequency
% flag = 'scale'; % Sampling Flag
%
% % Create the window vector for the design algorithm.
% win = blackman(N+1);
%
% % Calculate the coefficients using the FIR1 function.
% b = fir1(N, Fc/(Fs/2), 'low', win, flag);
Hd = dsp.FIRFilter( ...
'Numerator', [0 8.53141539653077e-07 4.281687969153e-06 ...
1.16857709830562e-05 2.4617846254652e-05 4.48111329570305e-05 ...
7.42051266750156e-05 0.000114966487008064 0.000169503668560397 ...
0.000240473791688123 0.000330780434945857 0.000443561270366648 ...
0.000582164749434703 0.000750115374139728 0.000951067444666977 ...
0.00118874755273178 0.00146688647608299 0.00178914151349583 ...
0.00215901066866936 0.00257974043401557 0.00305422923007986 ...
0.00358492881284345 0.00417374616021418 0.00482194848290178 ...
0.00553007406765281 0.00629785164851236 0.00712413091253511 ...
0.00800682658054859 0.00894287826378076 0.00992822798820385 ...
0.0109578169072131 0.0120256022985712 0.0131245954739236 ...
0.0142469207305535 0.0153838949584234 0.0165261269946815 ...
0.0176636353068032 0.0187859820984029 0.0198824214820926 ...
0.020942058964284 0.02195401914905 0.0229076183020233 0.0237925382288981 ...
0.024598997822419 0.0253179186204798 0.0259410807974293 ...
0.0264612661797127 0.0268723851319798 0.0271695844947929 ...
0.0273493341619222 0.0274094903537733 0.0273493341619222 ...
0.0271695844947929 0.0268723851319798 0.0264612661797127 ...
0.0259410807974293 0.0253179186204798 0.024598997822419 ...
0.0237925382288981 0.0229076183020233 0.02195401914905 0.020942058964284 ...
0.0198824214820926 0.0187859820984029 0.0176636353068032 ...
0.0165261269946815 0.0153838949584234 0.0142469207305535 ...
0.0131245954739236 0.0120256022985712 0.0109578169072131 ...
0.00992822798820385 0.00894287826378076 0.00800682658054859 ...
0.00712413091253511 0.00629785164851236 0.00553007406765281 ...
0.00482194848290178 0.00417374616021418 0.00358492881284345 ...
0.00305422923007986 0.00257974043401557 0.00215901066866936 ...
0.00178914151349583 0.00146688647608299 0.00118874755273178 ...
0.000951067444666977 0.000750115374139728 0.000582164749434703 ...
0.000443561270366648 0.000330780434945857 0.000240473791688123 ...
0.000169503668560397 0.000114966487008064 7.42051266750156e-05 ...
4.48111329570305e-05 2.4617846254652e-05 1.16857709830562e-05 ...
4.281687969153e-06 8.53141539653077e-07 0]);
end
y = step(Hd,double(x));
% [EOF]