plotting signals in frequency domain

์กฐํšŒ ์ˆ˜: 115 (์ตœ๊ทผ 30์ผ)
Sadi M Jawad Ahsan
Sadi M Jawad Ahsan 2022๋…„ 5์›” 8์ผ
๋Œ“๊ธ€: William Rose 2022๋…„ 5์›” 8์ผ
Q: In the operation of V.34 class voiceband modems, tone signals that are narrowly spaced apart must be quickly identified for initialization. We want to design a signal processing algorithm that can easily detect which signal is received. ITU-T V.25 and V.8 recommendations specify the signals as
๐‘ 0(๐‘ก) = ๐ด0 cos(2๐œ‹๐‘“c๐‘ก + ๐œƒ) : ANS signal
๐‘ 1(๐‘ก) = ๐ด1[1 + ๐œŒ cos(2๐œ‹๐‘“0t + ๐œ™)] cos(2๐œ‹๐‘“c๐‘ก + ๐œƒ) : ANSam signal
The parameters are given by: ๐œŒ = 0.2, ๐‘“0 = 15 Hz, ๐‘“c = 2100 Hz, ๐ด1 = 1, ๐ด0 = ๐ด1(1 +๐œŒ^2/2) Thevalues for ๐œƒ and ๐œ™ are arbitrary.
2. Plot the magnitudes of the Fourier transforms of the two signals. Confirm that ANS is a single tone and ANSam is a sum of three narrowly spaced tones. What is the spacing between the tones in the ANSam signal? [Hint: In order to have a high frequency resolution, the FFT points N must be large enough. Also, you might want to zoom into around f = 2100 Hz to be able to see the narrowly spaced tones clearly.]
My code:
p = 0.2;
f0 = 15;
fc = 2100;
A1 = 1;
A0 = A1 * ((1 + ((p.^2)/2)))*0.5;
n = 2^nextpow2(L);
theta = -pi+2*pi*rand(1, n);
phi = -pi+2*pi*rand(1, n);
fs = 4*fc*((2*n)+1); % Sampling frequency
T = 1/fs; % Sampling period
L = fs; % Length of signal
t = linspace(0, T, n); %(0:L-1)*T; % Time vector
s0 = A0 .* cos((2*pi*fc*t)+theta); % ANS signal
s1 = A1 .* (1+(p*cos((2*pi*f0*t)+phi))) .* cos((2*pi*fc*t)+theta); % ANSam signal
X = [s0; s1];
dim = 2;
Y = fft(X,n,dim);
P2 = abs(Y/L);
P1 = P2(:,1:n/2+1);
P1(:,2:end-1) = 2*P1(:,2:end-1);
for i=1:2
subplot(2,1,i)
plot(0:(fs/n):(fs/2-fs/n),P1(i,1:n/2))
title(['Row ',num2str(i),' in the Frequency Domain'])
end
Problem: Not getting output. Need help

์ฑ„ํƒ๋œ ๋‹ต๋ณ€

William Rose
William Rose 2022๋…„ 5์›” 8์ผ
@Sadi M Jawad Ahsan, Here is an example of what I was saying in my previous answer. Note that I define a vector of time values (t) early in the script. I use that vector to compute s1 and s2. I use upper case S1 and S2 to refer to the Fourier transforms of s1 and s2.
%constants provided in the problem statement
p = 0.2;
f0 = 15;
fc = 2100;
A1 = 1;
theta=2*pi*rand(1);
phi=2*pi*rand(1);
%constants I compute
fs=5*fc; %sampling rate (Hz)
dt=1/fs; %sampling interval (s)
T=1; %total signal duration (s)
N=T*fs; %points in the signal
t=(0:N-1)*dt; %vector of time values
df=1/T; %frequency resolution of the FFT
f=(0:N-1)*df; %vector of frequencies for the FFT
%compute the signals
A0 = A1 * ((1 + ((p.^2)/2)))*0.5;
s0 = A0 * cos(2*pi*fc*t+theta); % ANS signal
s1 = A1 * (1+p*cos(2*pi*f0*t+phi)) .* cos(2*pi*fc*t+theta); % ANSam signal
%compte the FFTs
S0 = fft(s0);
S1 = fft(s1);
%plot the entire two-sided amplitude spectra
figure;
subplot(211), plot(f,abs(S0),'-r',f,abs(S1),'-b');
xlabel('Frequency (Hz)'); ylabel('Amplitude'); grid on
legend('|S0|','|S1|')
%plot the amplitude spectra from 2050 to 2150 Hz
subplot(212), plot(f,abs(S0),'-r',f,abs(S1),'-b');
xlabel('Frequency (Hz)'); ylabel('Amplitude'); grid on
legend('|S0|','|S1|'); xlim([2050,2150])
Try it.
  ๋Œ“๊ธ€ ์ˆ˜: 2
Sadi M Jawad Ahsan
Sadi M Jawad Ahsan 2022๋…„ 5์›” 8์ผ
fs is given as 4fc(2n+1). Why are you using fs=5fc?
William Rose
William Rose 2022๋…„ 5์›” 8์ผ
I explained why I use fs=5*fc in my original post.
You interpret "n" to mean the number of points in the FFT. If so, then the definition ๏ฟฝs=1/๐‘‡s=4๐‘“c(2๐‘› + 1) makes no sense, and is simply wrong. I supose that n could mean something else, and that, with some alternative deifnition of n, the equation fs=1/๐‘‡s=4๐‘“c(2๐‘› + 1) could be reasonable.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ถ”๊ฐ€ ๋‹ต๋ณ€ (1๊ฐœ)

William Rose
William Rose 2022๋…„ 5์›” 8์ผ
ํŽธ์ง‘: William Rose 2022๋…„ 5์›” 8์ผ
[correcting my spelling mstakes]
You have made an excellent start on the problem.
I do not understand your choice of fs. I recommend that you choose fs=5*fc, i.e. sample at 5 times the rate of the main frequency in th problem. This is not really all that fast, because it means you use 5 samples per cycle of the sinusoid, i.e. one point every 72 degrees of phase. I recommend that you construct signals with a duration of 1 second or more. This guarantees that the frequency resolution of the FFT will be 1 Hz (freq resolution=1/duration). If you want a resolution of 0.5 Hz, the signals should be 2 seconds long.
Make a vector of frequencies, which will be the x-axis values of the plot.
Then compute the FFTs, take the absolute value, and plot.
  ๋Œ“๊ธ€ ์ˆ˜: 3
Sadi M Jawad Ahsan
Sadi M Jawad Ahsan 2022๋…„ 5์›” 8์ผ
Another issue is how to show that a signal comprises of three different tones?
William Rose
William Rose 2022๋…„ 5์›” 8์ผ
@Sadi M Jawad Ahsan, the plot generated by my code, shown in my answer below, shows three distinct peaks in the S1 spectrum. This indicates three tones: the carrier and the two sidebands. You probably know this, but just in case you don;t this is a classic case of amplitude modulation. p is the modulation index, which should never exceed unity. If you increase p, the sideband amplitude will increase.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Parametric Spectral Estimation์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by