MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
reset(obj.pHighpass);
end
end
end

Class Definition File for Lowpass FIR Component of Bandpass Filter

classdef LowpassFIRFilter < matlab.System
% Implements eighth-order lowpass FIR filter with 0.6pi cutoff

properties (Nontunable)
% Filter coefficients
Numerator = [0.006,-0.0133,-0.05,0.26,0.6,0.26,-0.05,-0.0133,0.006];
end

properties (DiscreteState)
State
end

methods (Access = protected)
function setupImpl(obj)
obj.State = zeros(length(obj.Numerator)-1,1);
end

function y = stepImpl(obj,u)
[y,obj.State] = filter(obj.Numerator,1,u,obj.State);
end

function resetImpl(obj)
obj.State = zeros(length(obj.Numerator)-1,1);
end
end
end

Class Definition File for Highpass FIR Component of Bandpass Filter

classdef HighpassFIRFilter < matlab.System
% Implements eighth-order highpass FIR filter with 0.4pi cutoff

properties (Nontunable)
% Filter coefficients
Numerator = [0.006,0.0133,-0.05,-0.26,0.6,-0.26,-0.05,0.0133,0.006];
end

properties (DiscreteState)

34 System object Usage and Authoring

Free download pdf