Please all three questions !! The following analogue signal consisting of three
ID: 2079412 • Letter: P
Question
Please all three questions !! The following analogue signal consisting of three equal-strength sinusoids of frequencies 3 Hz, 3.5 Hz and 4 Hz is sampled at a rate of 10 Hz. Plot the absolute values and powers of DFT for data length of 1 sec, 2 sec, 4 sec and 10 sec x = cos (2* pi* t*3) + cos (2*pi*t*3.5) + cos (2*pi*t*4) Do you need to plot full length of DFT to understand the frequency contents in the signals? Plot the absolute values and powers of DFT for R-R interval (seconds) data length (1321.5 seconds) and Determine the most powerful frequency component in the signals.Explanation / Answer
clc;
close all;
clear all;
%ANSWER FOR 1)
Fs = 10;
L = 2; % LENGTH OF SEQUENCE
t = 0:1:L-1;
x = cos(2*pi*t*3)+cos(2*pi*t*3.5)+cos(2*pi*t*4);
title('Length0 = 1');
subplot(5,3,1);
plot(t,x);
xlabel('time');
ylabel('x(t)');
NFFT = 2;
X = fftshift(fft(x,NFFT));
Pwr = X.*conj(X)/(NFFT*L);
nVALS = Fs*(0:NFFT-1);
subplot(5,3,2);
plot(nVALS,abs(X));
xlabel('f');
ylabel('X(jw)');
subplot(5,3,3);
plot(nVALS,Pwr);
xlabel('f');
ylabel('P');
title('Length = 1');
L = 3; % LENGTH OF SEQUENCE
t = 0:1:L-1;
x = cos(2*pi*t*3)+cos(2*pi*t*3.5)+cos(2*pi*t*4);
subplot(5,3,4);
plot(t,x);
xlabel('time');
ylabel('x(t)');
NFFT = 3;
X = fftshift(fft(x,NFFT));
Pwr = X.*conj(X)/(NFFT*L);
nVALS = Fs*(0:NFFT-1);
subplot(5,3,5);
plot(nVALS,abs(X));
xlabel('f');
ylabel('X(jw)');
subplot(5,3,6);
plot(nVALS,Pwr);
xlabel('f');
ylabel('P');
title('Length = 2');
L = 5; % LENGTH OF SEQUENCE
t = 0:1:L-1;
x = cos(2*pi*t*3)+cos(2*pi*t*3.5)+cos(2*pi*t*4);
subplot(5,3,7);
plot(t,x);
xlabel('time');
ylabel('x(t)');
NFFT = 5;
X = fftshift(fft(x,NFFT));
Pwr = X.*conj(X)/(NFFT*L);
nVALS = Fs*(0:NFFT-1);
subplot(5,3,8);
plot(nVALS,abs(X));
xlabel('f');
ylabel('X(jw)');
subplot(5,3,9);
plot(nVALS,Pwr);
xlabel('f');
ylabel('P');
title('Length = 4');
L = 11; % LENGTH OF SEQUENCE
t = 0:1:L-1;
x = cos(2*pi*t*3)+cos(2*pi*t*3.5)+cos(2*pi*t*4);
subplot(5,3,10);
plot(t,x);
xlabel('time');
ylabel('x(t)');
NFFT = 11;
X = fftshift(fft(x,NFFT));
Pwr = X.*conj(X)/(NFFT*L);
nVALS = Fs*(0:NFFT-1);
subplot(5,3,11);
plot(nVALS,abs(X));
xlabel('f');
ylabel('X(jw)');
subplot(5,3,12);
plot(nVALS,Pwr);
xlabel('f');
ylabel('P');
title('Length = 10');
L = 2643; % LENGTH OF SEQUENCE
t = 0:1:L-1;
x = cos(2*pi*t*3)+cos(2*pi*t*3.5)+cos(2*pi*t*4);
subplot(5,3,13);
plot(t,x);
xlabel('time');
ylabel('x(t)');
%ANSWER FOR 3)
%MOST POWERFUL FREQUENCY COMPONENT = 0Hz
NFFT = 2643;
X = fftshift(fft(x,NFFT));
Pwr = X.*conj(X)/(NFFT*L);
nVALS = Fs*((-NFFT/2):1:(NFFT/2)-1);
subplot(5,3,14);
plot(nVALS,X);
xlabel('f');
ylabel('X(jw)');
%display(size(X));
subplot(5,3,15);
plot(nVALS,Pwr);
xlabel('f');
ylabel('P');
title('Length = 2643');
2) It is necessary to plot full length when number of samples are less. But when number of samples is large, it is not necessary.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.