1
$\begingroup$

I am trying to modulate the signal bl_msg_time (this is a speech signal) using DSB-SC modulation however the signal doesn't appear centered at the carrier frequency. Below is the matlab code and the result of the plot.

f_car = 1000000;
msg_dsb_time = bl_msg_time .* cos(2*pi*f_car*t);
msg_dsb_freq = fftshift(fft(msg_dsb_time));
msg_dsb_freq=msg_dsb_freq/length(msg_dsb_freq);
plot(fx,abs(msg_dsb_freq));

enter image description here

$\endgroup$

closed as off-topic by Jason R, Peter K. Nov 28 '17 at 13:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions requesting working code written to a specification are off-topic as they are unlikely to benefit anyone else. Instead, describe the problem you're solving and where you're stuck." – Jason R, Peter K.
If this question can be reworded to fit the rules in the help center, please edit the question.

0
$\begingroup$

Here is a code snipped that works, you can get it and modify according to your needs.

Fsim = 5E6;         % simulation sampling frequency
Tsim = 1/Fsim;      % simulation sampling period
Tdur = 0.1;         % duration of simulation in seconds...
t = [0:Tsim:Tdur];  % t = n*Tsim; sampled time instants... 
L = length(t);      % number of samples in the signal

f_car = 1E6;        % DSB-SC modulation carrier frequency

bl_msg_time = filter(fir1(264,0.03),1,randn(1,L));   % generate a bandlimited message signal

msg_dsb_time = bl_msg_time .* cos(2*pi*f_car*t);
msg_dsb_freq = fftshift(fft(msg_dsb_time));
msg_dsb_freq=msg_dsb_freq/length(msg_dsb_freq);

fx = linspace(-Fsim/2,Fsim/2,L);
plot(fx,abs(msg_dsb_freq));
title(['DSB-SC modulated signal, Fcar = ' , num2str(f_car)])
xlabel('frequency in Hz') 

The produced output is:

enter image description here

As you can see the modulated signal is centered at the correct frequency.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.