Please demonstrate MATLAB code needed to solve, thank you. For all parts of this
ID: 3726074 • Letter: P
Question
Please demonstrate MATLAB code needed to solve, thank you.
For all parts of this problem the input signal is given by x[n] = 1+2 cos(0Arn + 0.2)+1.5 cos(0.6-04r) frequency 0.4 and passes the DC and 0.6 input components. Demonstrate your results using MATLAB. Hint: Examine how two of the terms of Hle" in problem 2 notched out the normalized frequency /3 normalized frequency 0.4 and passes the DC and 0.6 input components. What a) Design a second-order FIR filter that notches out the normalized b) Design an N-point moving averaging filter that notches out the c) Is it possible to design an M -point moving averaging filter that notches out the normalized frequency 0.6 and passes the DC and 0.4 input components? Explain.Explanation / Answer
Executable code
Matlab code for A:
lowpassFilt = dsp.LowpassFilter('DesignForMinimumOrder',false, ...
'FilterOrder',N,'PassbandFrequency',Fp,'SampleRate',Fs,...
'PassbandRipple',0.01, 'StopbandAttenuation',80);
tic
while toc < 10
x = randn(256,1);
y = lowpassFilt(x);
scope(y);
end
vbwFilter = dsp.VariableBandwidthFIRFilter('CutoffFrequency',1e3);
tic
told = 0;
while toc < 10
t = toc;
if floor(t) > told
% Add 1 kHz every second
vbwFilter.CutoffFrequency = vbwFilter.CutoffFrequency + 1e3;
end
x = randn(256,1);
y = vbwFilter(x);
scope(y);
told = floor(t);
end