Consider an input signal x_total and the complex envelope of an output signal y_total in MATLAB:
T = 10e-9;
f_s = 1e12;
t = [0 : 1/f_s : T]';
f_c = 11.5e9;
f_1 = -0.1e9;
f_2 = 0;
f = [f_1 f_2]';
x_1 = 1*sin(2*pi*(f_c + f(1))*t);
x_2 = 1*sin(2*pi*(f_c + f(2))*t);
x_total = x_1 + x_2;
y_envelope = A_out .* exp(1i* theta) .* exp(1i*Phi);
2 Questions:
How do I plot the spectrum of x_total? X_total = fft(x_total)
yields a complex result. I want the x-axis of my spectrum to be in Hertz.
And I want to plot the spectrum of my output signal y_total as well. From the complex envelope, can I say y_total = A_out*sin(2*pi*f_c*t + (theta+Phi))
?
I just read:
A = abs(X_total) * 2/(f_s*T)
should yield the amplitude
and f = linspace(0,f_s,length(X_total))
should yield the corresponding
frequency.
Why do I have to normalize the amplitude by 2/(f_s*T)
? Applying this code yields the spectrum for x_total
, which I want.
Applying the same for y_total
does not yield a spectrum at all, when I plot it. Why not?