Plotting signals in time domain
20 ビュー (過去 30 日間)
古いコメントを表示
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.
1. Plot ANS and ANSam signals in the time domain. Use sampling rate 𝑓s = 1/𝑇s = 4𝑓c(2𝑛 + 1), where 𝑛 = 0,1,2,…. Describe the difference of the two signals.
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;
theta = -pi+2*pi*rand(100,1);
phi = -pi+2*pi*rand(100,1);
n = 100;
fs = 4*fc*((2*n)+1); % Sampling frequency
T = 1/fs; % Sampling period
L = fs; % Length of signal
t = (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];
for i = 1:2
subplot(2,1,i)
plot(t(1:100),X(i,1:100))
title(['Row ',num2str(i),' in the Time Domain'])
end
Problem: It is not giving me a cosine output for the 1st part. I haven't attempted the 2nd part yet. Need help.
0 件のコメント
採用された回答
Image Analyst
2022 年 5 月 8 日
編集済み: Image Analyst
2022 年 5 月 8 日
You had theta and phi be column vectors while t was a row vector so it did implicit expansion to a 2-D array which you were not expecting. Plus t had a different number of elements than theta and phi (fix using linspace). Try this:
p = 0.2;
f0 = 15;
fc = 2100;
A1 = 1;
A0 = A1 * ((1 + ((p.^2)/2)))*0.5;
n = 100;
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];
for i = 1:2
subplot(2,1,i)
plot(t(1:100),X(i,1:100))
title(['Row ',num2str(i),' in the Time Domain'])
grid on;
end
4 件のコメント
Image Analyst
2022 年 5 月 8 日
And explain to me why the spectrum should be spikes (like a periodic function like sine or cosine would have) when you're just passing in random numbers?
To me, if you use random numbers, your spectrum will look random, and it does, as expected.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Filter Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


