Question

Reproduce Figures 9.2b and 9.2c on MATLAB, assuming that the square wave (Figure 9.2b) is a periodic symmetric square wave of normalized amplitude (A=1). Each student group should
decide the power spectral density level of the channel noise. Compute the Fourier transform of the periodic square wave.

s(t) 1 0 0 0 1 A T 2T 3T 4TI 5T -A (b) in unitat with the More (c)

clear all
close all
%%%%
T=12*pi; %number of period
x=linspace(0,T);
t=x/pi
y0=square(x); %square wave signal
y0ft=fft(y0); %calculating Fourier Transformof signal
y0fts=fftshift(y0ft);
y0ftFinal=abs(y0ft);
AWGN= rand(size(x)); %Calculating whit noise
Att=(1/3);
nSig= Att*AWGN;
y=y0+nSig; %Square wave signal with Gaussian noise
yft=fft(y); %Calculating Fourier Transform of new signal
yfts=fftshift(yft);
yftFinal=abs(yfts);
%%%%
subplot(2,1,1);
plot(t,y0)
title("Originalsignal without noise")
xlabel("period")
ylabel("Magnitude")
grid on
%%%
figure
subplot(2,1,1);
plot(t,y0ftFinal)
title("Fourier Transform of original signal")
xlabel("Period")
ylabel("Magnitude")
grid on
subplot(2,1,1);
plot(t,yftFinal)
xlabel("Period")
ylabel("Magnitude")
title("Fourier transform of original signal with noise")
grid on
.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB code with comments for explanation is given below in bold letters, followed by the results.

clc;
close all;
clear all;

% define time T
T = 12*pi;

% frequency of square wave
f = 1/(4*T);

% define the sampling time
fs = 1;

% define time t
t = 0:1/fs:10*T;

% percentage Duty cycle
D =25;

% define the signal s(t)
s = square(2*pi*f*t,D);

% plot the signal
figure;
plot(t,s);grid on;ylim([-5 5]);xlim([0 6*T]);
title('original signal s(t)');

% now define the noise
AWGN= rand(size(s));

Att=(1);
nSig= Att*AWGN;

% add the noise to signal
y=s+nSig; %Square wave signal with Gaussian noise

% plot the noise contaminated signal
figure;
plot(t,y);grid on;ylim([-5 5]);xlim([0 6*T]);
title('noisy signal y(t)');


% take the fft of the original signal
% Finding FFT of s(t)
N = nextpow2(length(s));
S = fftshift(fft(s,2^N));
S = 2*S/length(s);
k = -(length(S)-1)/2:1:length(S)/2;
f = k/length(S) * fs;
figure;plot(f,abs(S));grid;
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Double sided Magnitude spectrum of original signal s(t)');
xlim([-1 1]);

% take the fft of the noise contaminated signal
% Finding FFT of y(t)
N = nextpow2(length(y));
Y = fftshift(fft(y,2^N));
Y = 2*Y/ length(y);
k = -(length(Y)-1)/2:1:length(Y)/2;
f = k/length(Y) * fs;
figure;plot(f,abs(Y));grid;
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Double sided Magnitude spectrum of noisy signal y(t)');
xlim([-1 1]);

original signal s(t) LO 4 3 2 1 0 -1 N -3 -4 -5 50 100 150 200

noisy signal y(t) 5 4 3 2 www 0 Wwwwwwwwwwww MA -1 N -3 -4 -5 50 100 150 200

Double sided Magnitude spectrum of original signal s(t) 0.9 0.8 0.7 0.6 0.5 Amplitude 0.4 0.3 0.2 0.1 m What -0.08 -0.06 -0.0Double sided Magnitude spectrum of noisy signal y(t) 0.8 0.7 0.6 0.5 Amplitude 0.4 0.3 0.2 0.1 White -0.08 -0.06 -0.04 0.04 0Double sided Magnitude spectrum of noisy signal y(t) 0.8 0.7 0.6 0.5 Amplitude 0.4 0.3 0.2 0.1 White -0.08 -0.06 -0.04 0.04 0

Add a comment
Know the answer?
Add Answer to:
Reproduce Figures 9.2b and 9.2c on MATLAB, assuming that the square wave (Figure 9.2b) is a...
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
  • Exercise 4. Computing and displaying the Fourier Transform of a signal Later in the semester it will become useful to d...

    Exercise 4. Computing and displaying the Fourier Transform of a signal Later in the semester it will become useful to determine the frequency response of a signal or system by taking the Fourier Transform empirically (rather than computing it analytically). To do so we make use of the fft and fftshift commands. The fft command is an efficient implementation of the Discrete Fourier Transform (DFT) known as the Fast Fourier Transform (FFT). When the FFT is computed the samples are...

  • Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts...

    Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts = 1/fs; % Number of samples, assume 1000 samples l = 1000; t = 0:1:l-1; t = t.*ts; % Convert the sample index into time for generation and plotting of signal % Frequency and amplitude of the sensor f1 = 110; a1 = 1.0; % Frequency and amplitude of the power grid noise f2 = 60; a2 = 0.7; % Generating the sinusoidal waves...

  • I need help in MATLAB. I'm working on a circuits lab report and I want to...

    I need help in MATLAB. I'm working on a circuits lab report and I want to plot the derivative of an input signal. The circuit is a differentiator OpAmp. It is receiving a triangle wave as an input and should output a square wave. (I've included my existing code.) The output formula is: Vout = -(Rf)*C*(dVin/dt) Where Rf is feedback resistance: Rf = 1*10^6; and C = 1*10^-6. EXISTING CODE: %% This section is copied, and then modified from another...

  • I wrote a Matlab program for the figure below. When I plot the waves, they look...

    I wrote a Matlab program for the figure below. When I plot the waves, they look the same. Why do the two waves frequencies look same and How do I avoid it? (I really do need this part of the question answered.) N = 200; % Total number of time domain samples in simulation. Fs = 100 ;% sampling frequency. F1 = 10; % frequency of wave - 1. F2 = 90; % frequency of wave - 2. phi =...

  • Exercises: u used to the instructor b the end of next lab. 20 102 Plot the f(t)-sinc(20r) cos(300...

    Exercises: u used to the instructor b the end of next lab. 20 102 Plot the f(t)-sinc(20r) cos(300t)sinc (10t) cos(100t) Use the fast Fourier transform to find the magnitude and phase spectrum of the signal and plot over an appropriate range. Use appropriate values for the time interval and the sampling interval. Note that in Matlab sinc(x)-, so we need to divide the argument by n to make it match the given function. Le, sinc(20t/pi) Hint: Use the parameters from...

  • Part 1: Exponential Fourier series The following MATLAB code calculates the exponential Fourier series coefficient for...

    Part 1: Exponential Fourier series The following MATLAB code calculates the exponential Fourier series coefficient for the signal x(t) shown in the figure below, plots it's double sided amplitude spectrum IDn l, double sided phase spectrem LDn, and the resulting signal xn(t). 4r 4a Periodic signal x(t) 1.1 Show that the complex Fourier Series Coefficients written as: D 1.2 Use the following Matlab to general the two sided spectral line. 1.3 Execute the Matlab code with To = 2π and...

  • 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)...

  • MATLAB code starts here --------- clear T0=2; w0=2*pi/T0; f0=1/T0; Tmax=4; Nmax=15; %--- i=1; for t=-Tmax: .01:Tmax...

    MATLAB code starts here --------- clear T0=2; w0=2*pi/T0; f0=1/T0; Tmax=4; Nmax=15; %--- i=1; for t=-Tmax: .01:Tmax T(i)=t; if t>=(T0/2) while (t>T0/2) t=t-T0; end elseif t<=-(T0/2) while (t<=-T0/2) t=t+T0; end end if abs(t)<=(T0/4) y(i)=1; else y(i)=0; end i=i+1; end plot(T,y),grid, xlabel('Time (sec)'); title('y(t) square wave'); shg disp('Hit return..'); pause %--- a0=1/2; F(1)=0; %dc freq C(1)=a0; for n=1:Nmax a(n)=(2/(n*pi))*sin((n*pi)/2); b(n)=0; C(n+1)=sqrt(a(n)^2+b(n)^2); F(n+1)=n*f0; end stem(F,abs,(C)), grid, title(['Line Spectrum: Harmonics = ' num2str(Nmax)]); xlabel('Freq(Hz)'), ylabel('Cn'), shg disp('Hit return...'); pause %--- yest=a0*ones(1,length(T)); for n=1:Nmax yest=yest+a(n)*cos(2*n*pi*T/T0)+b(n)*sin(2*n*pi*T/T0);...

  • NB! This task is required to be solved in matlab. this task also requires the use...

    NB! This task is required to be solved in matlab. this task also requires the use of the function displayDualSpectrum(); which i have pasted in the bottom. the tasks that i need help with are A), B) and C). this is a multi-part question. Task - Frequency mixing We use a basic signal that can be described mathematically as follows: with this We shall then make an amplitude modulated signal: where fc is the carrier frequency. the code below specifies...

  • Now use MATLAB to generate and plot 15seconds of this signal in the time-domain.Use the fft()...

    Now use MATLAB to generate and plot 15seconds of this signal in the time-domain.Use the fft() function to find the fourier transform of this signal and plot its magnitude spectrum School of Engineering Task 3 - The Fourier Transform: Scaling property Exercise: Let's take a look now at using the Fourier transform on aperiodic signals. Consider the real exponential signal from the discharging capacitor in tas 3 of laboratory 1 which was found to be: You(t)=e"u(t) Begin by calculating manually...

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