Professional Documents
Culture Documents
Task - 3
Slot: L5+L6
Team :
22BEC0962 - Pugalarasu M
22BEC0389 - Varun M
1
Question 1 :
Code :
clc;
clear
all;
close
all; %
Given
fs=1000;% Sampling Frequency
dur=2; % Time duriation
t=0:(1/fs):dur-(1/fs);
% Plot 1
x=sin(2*pi*150*t);% sine wave
subplot(411); plot(t,x);
title('Sin Wave');ylabel('Amplitude');xlabel('Time');
% Plot 3
xrt1=ifft(dft,4096);% inverse Dft
xrt=xrt1([1:length(x)]);
subplot(413);
plot(t,xrt);
title('Reconstucted sine wave');ylabel('Amplitude');xlabel('Time');
2
Question 2 :
Code :
clc; clear all; close all; % Given
fs=1000; % Sampling Frequencey dur=2;
% Time Duriation t=0:(1/fs):dur-
(1/fs); % Time
% Plot 1
x=sin(2*pi*150*t); % sine Wave
subplot(411); plot(t,x); title('Sin
Wave');ylabel('Amplitude');xlabel('Ti
me');
% Plot 3
xrt1=ifft(dft,4096);% Inverse Dft , Reconstruction
xrt=xrt1([1:length(x)]); subplot(413); plot(t,xrt); title('Reconstucted
sine wave');ylabel('Amplitude');xlabel('Time');
3
% PLot 4 subplot(414); plot(t,(x-xrt));% Error Between original sine
and Reconstructed wave
title('Error');ylabel('Amplitude');xlabel('Time');
Question 3 :
Code :
4
clc; clear
all; close
all;
% Given frequencies=[100,200,400,600,800,1000,1200,1400];
%
Frequencies fs=5000; % Sampling frequency duration=0.1; %
Duration t=0:1/fs:duration; % Time sum_sine_wave =
zeros(size(t));
% Plot 1 subplot(411);
plot(t,sum_sine_wave);
xlabel('Time (s)');
ylabel('Amplitude');
title('Time Domain Representation of Sum of Sine Waves');
% Plot 2 subplot(412);
plot(frequencies_dft,abs(X));
xlabel('Frequency (Hz)'); ylabel('Magnitude');
title('Magnitude Response of Signal (DFT)');
% Plot 3 subplot(413);
plot(t,real(filtered_signal(1:length(t))));
xlabel('Time (s)'); ylabel('Amplitude');
title('Time Domain Filtered Signal (800 Hz to 1000 Hz)');
5
% DFT of the filtered signal
filtered_signal_dft = fft(filtered_signal, N);
Inference
Question 1:
• Learnt how to get the magnitude of the given wave using the function fft().
• Learnt how to get back the original signal from transformed signal using the function ifft().
• Learnt that there is always an error between the original signal and the reconstructed one.
Question 2:
• Learnt how to get the magnitude of given wave using the function fft().
• Learnt how to get back the original signal from transformed signal using the function ifft().
• Learnt how to get response for a particular range of frequency from the original response.
6
Question 3:
• Learnt how to generate a signal which is the sum of signals each with different frequencies.
• Learnt how to get the time domain signal for a particular range of frequency (filter).
• And to get magnitude response of that filtered signal.