plotting signals in frequency domain
Show older comments
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
Accepted Answer
More Answers (1)
William Rose
on 8 May 2022
Edited: William Rose
on 8 May 2022
0 votes
[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 Comments
Sadi M Jawad Ahsan
on 8 May 2022
Sadi M Jawad Ahsan
on 8 May 2022
William Rose
on 8 May 2022
@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.
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!