Thanks. Fourier Series & Transforms Sine waves 1. Create a function that is the
ID: 2267632 • Letter: T
Question
Thanks. Fourier Series & Transforms Sine waves 1. Create a function that is the combination of three sine waves A = 12 f 42 kHz f,=66 kHz A2-7 As=9 2. Perform a fft on this, and plot its magnitude (abs). Adjust the x axis so that you can clearly see the frequencies present. 3. Add a constant of 8 to your function. Repeat the fft. What does this do? Square Wave The Fourier series for a square wave is a sum of odd harmonics. The first sine wave (fundamental) has the frequency of the square wave. The sum looks like this: x(t) = sinCaf) + 1/3 sin(3*2 ) + 1/5 sin(5*2m) + 1/7 sin(7*2m) + 1. Generate this function in a way that you can adjust the number of terms. Plot this with increasing terms, and comment on what you see. 2. Create a square wave with a frequency of 65 Hz, a sampling frequency of 4000 Hz, an amplitude of 50, and a duration of 80 ms. Plot it. Now take the Fast Fourier Transform of your square wave. You want to plot this vs frequency, and the range will go from zero to the sampling frequency. Is this what you would expect? 3.Explanation / Answer
% FIRST FOUR QUESTIONS ARE ANSWERED THROUGH CODE
% FOURIER SERIES
clc;
clear all;
% PART 1
A1 = 12;
A2= 7;
A3= 9;
F1 = 17000;
F2 = 42000;
F3 = 66000;
t = 0:0.001:2 *pi;
X1 = A1 * sin( 2 * pi * F1* t);
X2 = A2 * sin( 2 * pi * F2* t);
X3 = A3 * sin( 2 * pi * F3* t);
y = X1 + X2 +X3;
plot(t, y);
xlabel('time -->');
ylabel('Amplitude');
legend (' Time domain signal');
% PART 2
z = fft(y);
figure
plot(abs(z));
xlabel('frequency -->');
ylabel('Amplitude');
legend (' Frequency domain signal');
% PART 3
%adding constant 8 to this signal
x = y + 8;
figure
plot(t, x);
xlabel('time -->');
ylabel('Amplitude');
legend (' Time domain signal');
w = fft(x);
figure
plot(abs(w));
xlabel('frequency -->');
ylabel('Amplitude');
legend (' Frequency domain signal');
% PART 4
% PART B PART 1
% Generating square wave by sin wave
f = 50;
T = 1/f;
n = input(' Enter number of terms to be added');
t = 0:.001:2*pi ;
y = zeros(100,length(t));
x = zeros(size(t));
for k = 1:2:(n+4)
x = x + sin(k*t)/k;
y((k+1)/2,:) = x;
end
plot(y(1:2:99,:)')
xlabel('time -->');
ylabel('Amplitude');
legend (' Time domain signal with multiple sine');
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.