Use MATLAB to solve the following questions: Generate the input signal, x[n] = 6
ID: 2081128 • Letter: U
Question
Use MATLAB to solve the following questions:
Generate the input signal, x[n] = 6 + 4 cos (2pi. 1 .nT_s) + 2cos(2pi. 10. nT_s), with T_s = 0.002 sec. Pass it through a 35-sample moving average filter. Display the output, y[n], along with the input x[n] in the same window for n = 0 to 1000. Pass the 1 Hz signal alone through this filter for a large number of samples and estimate the filters' magnitude response (as the ratio of RMS output and input sequences). Repeat this for the 10 Hz signal. Use the magnitude responses obtained in Part (b) to estimate the filter's response, y_est [n], from the input sequence (without passing the signal through the actual filter). Plot y[n] from Part (a) and y_est (n) together, and comment on the results (ignore the first 34 and last 34 samples).Explanation / Answer
1]
n=0:1:1000;
Ts=0.002;
x1 = 6+(4*cos(2*pi*1.*n*Ts))+(2*cos(2*pi*10.*n*Ts));
windowWidth = 35; % Whatever you want.
kernel = ones(windowWidth,1) / windowWidth;
y = filter(kernel, 1, x1);
subplot(2,1,1);
plot(x1);
title('input');
subplot(2,1,2);
plot(y);
title('output');
When the input signal is a sin wave of 1 Hz, it does not change the rms value of the input signal(1 Hz).
When the input signal is a sin wave of 10 Hz, it halves the rms value of the input signal(10 Hz).
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.