Question

Write a Matlab code to generate the signal y(t)=10*(cos(2*pi*f1*t)+ cos(2*pi*f2*t)+ cos(2*pi*f3*t)), where f1=500 Hz, f2=750 Hz...

Write a Matlab code to generate the signal y(t)=10*(cos(2*pi*f1*t)+ cos(2*pi*f2*t)+ cos(2*pi*f3*t)), where f1=500 Hz, f2=750 Hz and f3=1000 Hz. Plot the signal in time domain.

  1. Sketch the Fourier transform of the signal with appropriately generating frequency axis.
  2. Apply an appropriate filter to y(t) so that signal part with frequency f1 can be extracted. Sketch the Fourier transform of the extracted signal.
  3. Apply an appropriate filter to y(t) so that signal part with frequency f2 can be extracted. Sketch the Fourier transform of the extracted signal.
  4. Apply an appropriate filter to y(t) so that signal part with frequency f3 can be extracted. Sketch the Fourier transform of the extracted signal.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB Code to plot the signal in time domain

clc;
clear all;
close all;

f1 = 500;
f2 = 750;
f3 = 1000;

t = 0:0.0000001:0.05;
y = 10*(cos(2*pi*f1*t) + cos(2*pi*f2*t) + cos(2*pi*f3*t));


plot(t,y);
grid on;
xlabel('Time, t(s)');
ylabel('y(t)');
title('Plot of the signal y(t)');

After running the code, we get the following plot

To sketch the Fourier Transform of the Signal

MATLAB Code

clc;
clear all;
close all;

f1 = 500;
f2 = 750;
f3 = 1000;

fs = 3*f3;
Ts = 1/fs;

n = 0:1000;
y = 10*(cos(2*pi*f1*n*Ts) + cos(2*pi*f2*n*Ts) + cos(2*pi*f3*n*Ts));
w = 0:pi/100000:pi;
Y = y*exp(-j*n'*w);


figure
plot(w/(2*pi)*fs,abs(Y));
grid on;
xlabel('Frequecny, f (Hz)');
ylabel('|Y(\Omega)|');
title('Magnitude Spectrum of the input Signal');

After running the code we get the output as

To extract the frequency f1

We have to use a low pass filter with a cut off frequency greater than 500Hz. So I am using 600 Hz. I am using a Butterworth filter with an order of 31

MATLAB Code

clc;
clear all;
close all;

f1 = 500;
f2 = 750;
f3 = 1000;

fs = 3*f3;
Ts = 1/fs;

n = 0:1000;
y = 10*(cos(2*pi*f1*n*Ts) + cos(2*pi*f2*n*Ts) + cos(2*pi*f3*n*Ts));
w = 0:pi/100000:pi;

[b,a] = butter(31,2*600/fs); % Butterworth Low Pass filter of order 31 and cut off frequency of 600 Hz
yout = filter(b,a,y);

w = 0:pi/100000:pi;
Yout = yout*exp(-j*n'*w);
figure
plot(w/(2*pi)*fs,abs(Yout));
grid on;
xlabel('Frequecny, f (Hz)');
ylabel('|Y_{0ut}(\Omega)|');
title('Magnitude Spectrum of the output Signal');

The result obtained

From the frequency response plot we can see that the signal with frequency 500 Hz is extracted

To extract the frequency f2

We have to use a band pass filter with a cut off frequency greater than 500Hz and less than 1000Hz.. So I am using 600 Hz and 900 Hz as the cut off frequencies.  I am using a Butterworth filter with an order of 31

MATLAB Code

clc;
clear all;
close all;

f1 = 500;
f2 = 750;
f3 = 1000;

fs = 3*f3;
Ts = 1/fs;

n = 0:1000;
y = 10*(cos(2*pi*f1*n*Ts) + cos(2*pi*f2*n*Ts) + cos(2*pi*f3*n*Ts));
w = 0:pi/100000:pi;

[b,a] = butter(31,[2*600/fs 2*900/fs], 'bandpass'); % Butterworth Band Pass filter, Order 31 & cut off frequency 600 & 900Hz
yout = filter(b,a,y);

w = 0:pi/100000:pi;
Yout = yout*exp(-j*n'*w);
figure
plot(w/(2*pi)*fs,abs(Yout));
grid on;
xlabel('Frequecny, f (Hz)');
ylabel('|Y_{0ut}(\Omega)|');
title('Magnitude Spectrum of the output Signal');

The result obtained

From the frequency response plot we can see that the signal with frequency 750 Hz is extracted

To extract the frequency f3

We have to use a high pass filter with a cut off frequency greater than 750Hz and less than 1000Hz. So I am using 900 Hz. I am using a Butterworth filter with an order of 31

MATLAB Code

clc;
clear all;
close all;

f1 = 500;
f2 = 750;
f3 = 1000;

fs = 3*f3;
Ts = 1/fs;

n = 0:1000;
y = 10*(cos(2*pi*f1*n*Ts) + cos(2*pi*f2*n*Ts) + cos(2*pi*f3*n*Ts));
w = 0:pi/100000:pi;

[b,a] = butter(31, 2*900/fs, 'high'); % Butterworth High Pass filter of order 31 and cut off frequency of 900 Hz
yout = filter(b,a,y);

w = 0:pi/100000:pi;
Yout = yout*exp(-j*n'*w);
figure
plot(w/(2*pi)*fs,abs(Yout));
grid on;
xlabel('Frequecny, f (Hz)');
ylabel('|Y_{0ut}(\Omega)|');
title('Magnitude Spectrum of the output Signal');

The result obtained

From the frequency response plot we can see that the signal with frequency 1000 Hz is extracted

Add a comment
Know the answer?
Add Answer to:
Write a Matlab code to generate the signal y(t)=10*(cos(2*pi*f1*t)+ cos(2*pi*f2*t)+ cos(2*pi*f3*t)), where f1=500 Hz, f2=750 Hz...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a MATLAB code for the question below. There is an initial signal containing 60 Hz...

    Write a MATLAB code for the question below. There is an initial signal containing 60 Hz sinusoid of amplitude 0.8 and a 150 Hz sinusoid of amplitude 1.2 corrupted by a noise - using the randn command - (zero-mean white noise with variance of 4). Plot the noisy signal in the time domain. After that compute the Fourier transform -using the fft command of the noisy signal, compute the two-sided spectrum. Define the frequency domain f and plot the single-sided...

  • Use MATLAB to generate code for this 4.Given the following functions: (1)  f1 (x, y) = cos...

    Use MATLAB to generate code for this 4.Given the following functions: (1)  f1 (x, y) = cos (3 x); (2) f2 (x, y) = cos (5 y); (3) f3 (x, y) = cos (3 x) cos (5 y); Please plot 3D plots/images for each of the functions. Please show your steps/ derivations to explain why you obtain those plots/figures.

  • Need MatLab code Exercise: Use MATLAB to generate the sinusoidal waveform: x(t) = 3 cos(1200) Consider...

    Need MatLab code Exercise: Use MATLAB to generate the sinusoidal waveform: x(t) = 3 cos(1200) Consider the frequency of this sinusoid and use this information to select an appropriate time-step and time array that will allow this signal to be correctly represented and displayed on a new MATLAB figure window (display 4 periods of this wave only). Now set up an appropriate frequency array and use the fft() and fftshift() functions to generate and plot the Fourier Transform (magnitude spectra)...

  • Please finish these questions. Thank you Given find the Fourier transform of the following: (a) e dt 2T(2 1) 4 cos (2t) (Using properties of Fourier Transform to find) a) Suppose a signal m(t) is giv...

    Please finish these questions. Thank you Given find the Fourier transform of the following: (a) e dt 2T(2 1) 4 cos (2t) (Using properties of Fourier Transform to find) a) Suppose a signal m(t) is given by m()-1+sin(2 fm) where fm-10 Hz. Sketch the signal m(t) in time domain b) Find the Fourier transform M(jo) of m(t) and sketch the magnitude of M(jo) c) If m(t) is amplitude modulated with a carrier signal by x(t)-m(t)cos(27r f,1) (where fe-1000 Hz), sketch...

  • (B) Implement Matlab code for each part as described below: i) Define the following signal in tim...

    Using MATLAB, Please read carefully, EXPLAIN CODE AND ANSWERS, DISCUSS RESULTS, I NEED EVERY PART (B) Implement Matlab code for each part as described below: i) Define the following signal in time and plot it where Ai 10, A2-3, fi-10 Hz, f2-40 Hz. part of the DFT, and discuss the results. zero. Do this carefully for both positive and negative frequencies. Call this signal G (f). ii) Compute the DFT S(f) of s (t) using the fft() function. Plot the...

  • An information signal is of the form s(t) = sin(2*pi*t)/t. The signal amplitude modulates a carrier...

    An information signal is of the form s(t) = sin(2*pi*t)/t. The signal amplitude modulates a carrier of frequency 10Hz. Find and sketch the Waveform and Fourier transform of the transmitted signal before and after AM modulation. For AM modulation you can consider the simple case of DSB format (or double-sideband suppressed carrier modulation).

  • need matlab code Exercise: Use MATLAB to generate a low frequency signal: xy(t) = 3 cos(1400)...

    need matlab code Exercise: Use MATLAB to generate a low frequency signal: xy(t) = 3 cos(1400) And a higher frequency signal: xz(t) = 2 cos(10,000st) Now add these two signals together to generate the dual-component signal: y(t) = 3 cos(14007a)+ 2 cos(10,000) Points to be addressed: Again, manually calculate the theoretical magnitude spectra of y(t) and show this in your report (use Microsoft Visio or similar for your diagram). Clearly label all axes! Contrast this working to what you see...

  • There is a system that can multiply and / or add several input signals (constants or variables) i...

    There is a system that can multiply and / or add several input signals (constants or variables) in the time domain; the input signals are f1 (t), f2 (t) and f3; the output signals are f4 (t), f5 (t) and f6 (t). The substime lowpass filter (FPBj) is a system that has a transfer function h (t) (H (w)), with unit gain in the operating area and cutoff frequency of + - 400 Hz. (The filter gain passes abruptly from...

  • Points) Consider the signal s(t) with Fourier Transform 10 1+ω. S(a) figure below, we impulse sam...

    points) Consider the signal s(t) with Fourier Transform 10 1+ω. S(a) figure below, we impulse sample s) at a frequency o, rads/second, e signal sa(t). Can you find a finite sampling frequency o such that ly recover s(t) from so()? If so, find it. If not, explain why not. a) (5 pts) In ting in the can perfectly you s (t) sa(t) →| Impulse sample at- rate o b) (5 pts) Now suppose we filter the signal s() with an...

  • Q1) Given an analog signal X(t) = 3 cos (2π . 2000t) + 2 cos (2π...

    Q1) Given an analog signal X(t) = 3 cos (2π . 2000t) + 2 cos (2π . 5500t) sampled at a rate of 10,000 Hz, a. Sketch the spectrum of the sampled signal up to 20 kHz; b. Sketch the recovered analog signal spectrum if an ideal lowpass filter with a cutoff frequency of 4 kHz is used to filter the sampled signal in order to recover the original signal ; c. Determine the frequency/frequencies of aliasing noise . Q2)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT