Skip to content

Instantly share code, notes, and snippets.

@mattgaidica
Last active December 15, 2020 00:32
Show Gist options
  • Save mattgaidica/750830fabadf664b36ece753efaf8c13 to your computer and use it in GitHub Desktop.
Save mattgaidica/750830fabadf664b36ece753efaf8c13 to your computer and use it in GitHub Desktop.
% MATLAB Code
% Generated by MATLAB(R) 9.9 and Signal Processing Toolbox 8.5.
% Generated on: 14-Dec-2020 15:39:25
% Elliptic Lowpass filter designed using FDESIGN.LOWPASS.
% All frequency values are in Hz.
Fs = 250; % Sampling Frequency
Fpass = 3; % Passband Frequency
Fstop = 5; % Stopband Frequency
Apass = 0.5; % Passband Ripple (dB)
Astop = 40; % Stopband Attenuation (dB)
match = 'both'; % Band to match exactly
% Construct an FDESIGN object and call its ELLIP method.
h = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'ellip', 'MatchExactly', match);
% flatten coefficients for ARM
coeffs = reshape(Hd.sosMatrix(:,[1 2 3 5 6])' .* [1 1 1 -1 -1]',[],1);
% create string for copy/paste, cut off last ,\n
coeffStr = sprintf('%1.10ff,\n',coeffs);
disp(coeffStr(1:end-2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment