Question

In: Electrical Engineering

3. For the following analog signal: xa(t) = 3sin(40πt) + 3cos(50πt) which is sampled at a...

3. For the following analog signal:
xa(t) = 3sin(40πt) + 3cos(50πt)
which is sampled at a rate of 100 samples/second.

a. Design an IIR digital filter that will pass the first component 3sin(40πt) with attenuation of
less than 1 dB and suppress the second component 3cos(50πt) at least 50 dB. The filter should be
monotonic in the passband and have ripple in the stopband.

b. Generate 500 samples of the sampled signal xa(t) at the given sampling rate and use the
filter you designed to process the sampled signal using MATLAB’s "filter" command.

c. Plot the original signal and the output signal in one window using MATLAB’s subplot
command ( in either a 1 X 2 arrangement or a 2 X 1 arrangement. Remember to title all plots and
label all axes.

Please include Matlab code. EVEN JUST PART A HELPS

Solutions

Expert Solution

Question (a)

Since the sampling frequency is

So the digital signal is

We need to pass the low frequency and stop . So we will take the pass band frequency as rad/sample and stop band frequency as rad/sample

Since we need monotonic pass band and ripples in passband we will use Chebyshev Type – II filter.

MATLAB Code

clc;
clear all;
close all;

fs = 100;
Wp = 0.45;
Ws = 0.48;
Rp = 1;
Rs = 50;

[N, Ws] = cheb2ord(Wp, Ws, Rp, Rs);
[b, a] = cheby2(N, Rs, Ws);

w = 0:pi/1000:pi;

H = freqz(b, a, w);

magH = abs(H);
magH_dB = 20*log10(magH);
pha_H = angle(H)*180/pi;

subplot(2,1,1);
plot(w/pi, magH_dB, 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Filter');

subplot(2,1,2);
plot(w/pi, pha_H, 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('Phase in degree');
title('Phase Response of the Filter');

The frequency response of the designed filter is shown below. After executing the above code, we will get

Question b and c

clc;
clear all;
close all;

fs = 100;
Wp = 0.45;
Ws = 0.48;
Rp = 1;
Rs = 50;

[N, Ws] = cheb2ord(Wp, Ws, Rp, Rs);
[b, a] = cheby2(N, Rs, Ws);

w = 0:pi/1000:pi;

H = freqz(b, a, w);

magH = abs(H);
magH_dB = 20*log10(magH);
pha_H = angle(H)*180/pi;

subplot(2,1,1);
plot(w/pi, magH_dB, 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Filter');

subplot(2,1,2);
plot(w/pi, pha_H, 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('Phase in degree');
title('Phase Response of the Filter');

%% Generate the discrete signal
n = 0:499;

x = 3*sin(0.4*pi*n) + 3*cos(0.5*pi*n);

y = filter(b,a,x);

%% Ploting the signals
figure
subplot(2,1,1)
stem(n,x,'linewidth', 2);
grid
xlabel('Time Index, n');
ylabel('Amplitude');
title('Input Sequence x[n]');

subplot(2,1,2)
stem(n,y,'linewidth', 2);
grid
xlabel('Time Index, n');
ylabel('Amplitude');
title('Output Sequence y[n]');

The final plot obtained

An add on if you would like

Suppose I am plotting the magnitude spectrum of the input and the output, then we can see that the high frequency component is removed.

The full code is given below

clc;
clear all;
close all;

fs = 100;
Wp = 0.45;
Ws = 0.48;
Rp = 1;
Rs = 50;

[N, Ws] = cheb2ord(Wp, Ws, Rp, Rs);
[b, a] = cheby2(N, Rs, Ws);

w = 0:pi/1000:pi;

H = freqz(b, a, w);

magH = abs(H);
magH_dB = 20*log10(magH);
pha_H = angle(H)*180/pi;

subplot(2,1,1);
plot(w/pi, magH_dB, 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Filter');

subplot(2,1,2);
plot(w/pi, pha_H, 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('Phase in degree');
title('Phase Response of the Filter');

%% Generate the discrete signal
n = 0:499;

x = 3*sin(0.4*pi*n) + 3*cos(0.5*pi*n);

y = filter(b,a,x);

%% Ploting the signals
figure
subplot(2,1,1)
stem(n,x,'linewidth', 2);
grid
xlabel('Time Index, n');
ylabel('Amplitude');
title('Input Sequence x[n]');

subplot(2,1,2)
stem(n,y,'linewidth', 2);
grid
xlabel('Time Index, n');
ylabel('Amplitude');
title('Output Sequence y[n]');

%% To find the DTFTs of the input and the output
X = x*exp(-j*n'*w);

Y = y*exp(-j*n'*w);

figure
subplot(2,1,1);
plot(w/pi, abs(X), 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('|X(e^{j\omega})|');
title('Magnitude Spectrum of the Input');


subplot(2,1,2);
plot(w/pi, abs(Y), 'linewidth', 2);
grid
xlabel('Normalized Frequency, \omega (\times \pi rad/sample)');
ylabel('|Y(e^{j\omega})|');
title('Magnitude Spectrum of the Output');

When you run this code, the last figure will be as follows

Here we can see that the frequency  .is not present and is eliminated in the output

We can see that only rad/sample frequency is present.


Related Solutions

3. For the following analog signal: xa(t) = 3sin(40πt) + 3cos(50πt) which is sampled at a...
3. For the following analog signal: xa(t) = 3sin(40πt) + 3cos(50πt) which is sampled at a rate of 100 samples/second. a. Design an IIR digital filter that will pass the first component 3sin(40πt) with attenuation of less than 1 dB and suppress the second component 3cos(50πt) at least 50 dB. The filter should be monotonic in the passband and have ripple in the stopband. ( 2 points ) b. Generate 500 samples of the sampled signal xa(t) at the given...
3sin(t)+3sin(t)sin(2t)=3cos(t)-cos(3t). I'm trying to solve for t.
3sin(t)+3sin(t)sin(2t)=3cos(t)-cos(3t). I'm trying to solve for t.
------An analog signal is sampled, quantized, and encoded into a binary PCM wave. The number of...
------An analog signal is sampled, quantized, and encoded into a binary PCM wave. The number of representation levels used is 1024. A synchronizing pulse is added at the end of each code word representing a sample of the analog signal. The resulting PCM wave is transmitted over a channel of bandwidth 24kHz using a 8 PAM system with raised-cosine spectrum. The rolloff factor is 0.5. (a) Find the rate (bit/s) at which information is transmitted through the channel. (b) Find...
A signal has the functional form f(t) = 5sin(40πt) and is sampled at a rate of...
A signal has the functional form f(t) = 5sin(40πt) and is sampled at a rate of 30 samples per second. What false alias frequency would you expect in the discrete data? What sampling rate would avoid aliasing this signal?
A signal with a maximum frequency of 3 kHz is sampled at 50 kHz. What would...
A signal with a maximum frequency of 3 kHz is sampled at 50 kHz. What would the required transition width be in Hertz to... (a) decimate the signal by a factor of 8? (b) decimate the signal by a factor of 5? (c) interpolate the signal by a factor of 4?
A continuous signal contains the following two components: x1(t) = 3 cos 20πt x2(t) = 3...
A continuous signal contains the following two components: x1(t) = 3 cos 20πt x2(t) = 3 cos 50πt (a) Find the minimum required sampling rate to avoid aliasing. (b) Draw the discrete time signals obtained after sampling, when sampled with Fs = 100 Hz. Explain the disadvantage(s), if any, of sampling beyond the Nyquist rate. (c) Assume the sampling rate is Fs= 40 Hz, which components are exposed to aliasing effects? Support your answer by showing “Nyquist intervals” and the...
Digitization of signals Consider the analog signal s(t) = 5sin(500t +p 5)+ cos(200t +p 4) to...
Digitization of signals Consider the analog signal s(t) = 5sin(500t +p 5)+ cos(200t +p 4) to be transferred over a digital communications system. (a) Compute the maximum allowable sampling period that the analog-to-digital converter (ADC) must use to ensure the perfect reconstruction of the signal at the receiver. (b) What theorem governs the choice made in part (a)? (c) How many samples of the analog signal do we need to store in order to reproduce 10p seconds of it (i.e.,...
.         Given the following non-periodic signal:    x(t) = 3 e-5t cos(12t) u(t)             Find the Fourier...
.         Given the following non-periodic signal:    x(t) = 3 e-5t cos(12t) u(t)             Find the Fourier transform expression X(ω) without using Table.             Calculate the magnitude spectrum of X(ω) for ω = π/8, π/4, and π/2
Problem 3: The carrier c(t) = 100cos(2p fct) is frequency modulated by the signal m(t) =...
Problem 3: The carrier c(t) = 100cos(2p fct) is frequency modulated by the signal m(t) = 5cos(20000pt) , where fc = 108 Hz. The peak frequency deviation is 20 kHz. Determine the amplitude and frequency of all the signal components that have a power level of at least 10% of the power of the un-modulated carrier component. Hint: The wide-band FM has frequency components, fc, fc+ fm, fc? fm, fc+2 fm, fc?2 fm, and so on. The amplitude of the...
Find the Fourier coefficients of the following signal. x(t) = 5 + 2sin(w0.t) + cos(2.w0.t) -...
Find the Fourier coefficients of the following signal. x(t) = 5 + 2sin(w0.t) + cos(2.w0.t) - 3sin(2.w0.t)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT