11 views (last 30 days)

Show older comments

There is modulation in a last graph of a signal (figure 1). At programm there is no such kind of modulation (there is only transfer of a signal on the carrier frequency). Why? Where a mistake?

MATLAB code:

% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

% +++++++++++++++++++++ Doppler Shift ++++++++++++++++++++++++++++++++++++

% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

%%Initialization

clear all; close all; clc; format longE;

% ~~~~~~~~~~~~~~~~~~~ Begin of the Programm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

% Initial parameters of the Signal

f=100; %Frequency of the signal (sin), [Hz];

Fc=1e3; %Carrier frequency, [Hz];

Fd=30*f; %Sampling frequencym, [Hz];

A=1; %Amplitude

%%~~~~~~~~~~~~~~~~~~Initializing Doppler Shift~~~~~~~~~~~~~~~~~~~~~~~~~~

c=3e8; %Speed of light, [m/a];

%````````````````````````````````Speeds: ```````````````````````````````

Fdoppler=10; %Maximal Doppler Shift, [Hz]

Speed=(Fdoppler*c)/(Fc+f); %Necessary speed in [m/s] for receiving necessary shift.

speeedfordisp=(Fdoppler*3.6*c)/(Fc+f); %Necessary speed in [m/s] for receiving necessary shift.

fprintf('\n\n\n\nAt the set parameters for receiving shift on %d Hz\nspeed is necessary: \n \t -- [m/s]:\t %.3f;\n \t -- [km/h]:\t %3f.\n\n', Fdoppler, Speed, speeedfordisp);

%``````````````````````````````````````````````

%New wave frequency (after Doppler Effect):

betta=Speed/c;

alpha=0;

f_dopl=((Speed*(Fc+f))/c)*cosd(alpha);

%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~ Passing a signal throught the channel with a Doppler Effect ~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%Parametrs of the signal

t=(0:1/Fd:1);

N = length(t);

NFFT = 16000;

FrequencyAxe=Fd*linspace(0,1,NFFT); %Frequency Axe;

%Initializing the signal

Signal=A*sin(2*pi*f.*t);

%Modulating the signal:

SignalModulated=Signal.*exp(1i*2*pi*(Fc).*t);

%Add Doppler Effect:

Spectr = fft(SignalModulated); %Conver to the Frequency Domain

SignalModulated_D=ifft(circshift(Spectr, [0 f_dopl])); %Add shift

%Demodulation the signal

SignalDemodulated=SignalModulated_D.*exp(-1i*2*pi*(Fc).*t);

%`````````````````````````````````````````````````````````````````````````

%```````````````````````` END OF PROGRAMM'S PART `````````````````````````

%`````````````````````````````````````````````````````````````````````````

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~ Calculating a spectr of the signals ~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%Spectr of the initial signal:

SpectrInitialSignal=(1/NFFT).*fft(Signal, NFFT); Plot_SpectrInitialSignal=abs(SpectrInitialSignal(1:NFFT));

%Spectr of the modulated signal:

SpectrModulatedSignal=(1/NFFT).*fft(SignalModulated, NFFT); Plot_SpectrModulatedSignal=abs(SpectrModulatedSignal(1:NFFT));

%Spectr of the modulated signal with a Doppler Effect:

SpectrModulatedSignal_D=(1/NFFT).*fft(SignalModulated_D, NFFT); Plot_SpectrModulatedSignal_D=abs(SpectrModulatedSignal_D(1:NFFT));

%Spectr of the demodulated signal (with a Doppler Effect):

SpectrDemodulatedSignal=(1/NFFT).*fft(SignalDemodulated, NFFT); Plot_SpectrDemodulatedSignal=abs(SpectrDemodulatedSignal(1:NFFT));

%`````````````````````````````````````````````````````````````````````````

%```````````````````````` END OF PROGRAMM'S PART `````````````````````````

%`````````````````````````````````````````````````````````````````````````

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Plot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%Intializing of label variables:

TimeAxe='Time, [s]';

FreqAxe='Frequency, [Hz]';

% TESTING PART (All plots are separated from each other)

figure(1)

%~~ SIGNALS ~~

%Plot the initial signal:

subplot(4,2,1);

plot(t, Signal);

xlabel(TimeAxe);

title('Initial signal');

%Plot the modulated signal

subplot(4,2,3);

plot(t,SignalModulated);

xlabel(TimeAxe);

title('Modulated signal');

%Plot the modulated signal with a Doppler Effect

subplot(4,2,5);

plot(t,SignalModulated_D);

xlabel(TimeAxe);

title('Modulated signal with a Doppler Effect');

%Plot the demodulated signal with a Doppler Effect

subplot(4,2,7);

plot(t,SignalDemodulated);

xlabel(TimeAxe);

title('Demodulated signal');

%`````````````

%~~ SPECTRS ~~

%Plot the SPECTR of the initial signal

subplot(4,2,2);

plot(FrequencyAxe,Plot_SpectrInitialSignal);

xlabel(FreqAxe);

title('Spectr of the initial signal');

%Plot the SPECTR of the modulated signal:

subplot(4,2,4);

plot(FrequencyAxe,Plot_SpectrModulatedSignal);

xlabel(FreqAxe);

title('Spectr of the modulated signal');

%Plot SPECTR of the modulated signal with Doppler Effect

subplot(4,2,6);

plot(FrequencyAxe,Plot_SpectrModulatedSignal_D);

xlabel(FreqAxe);

title('SPECTR of the modulated signal \bf with Doppler Effect');

%Plot SPECTR of the demodulated signal:

subplot(4,2,8);

plot(FrequencyAxe,Plot_SpectrDemodulatedSignal);

xlabel(FreqAxe);

title('Spectr of the demodulated signal');

%`````````````

%GRAPHICS

%~~ Signals ~~

figure(2);

%Plot the initial signal and demodulated signal:

subplot(2,1,1);

hold on;

%Plot the initial signal:

plot(t,Signal,'m');

%Plot the recieved signal:

plot(t,SignalDemodulated, 'r');

hold off;

xlabel(TimeAxe);

legend('Initial signal','Demodulated signal');

title('Initial signal and demodulated signal');

%Plot the modulated signal and the modulated signal with the Doppler Effect:

subplot(2,1,2);

hold on;

%Plot the modulated signal:

plot(t,SignalModulated, 'm');

%Plot the modulated signal with a Doppler Effect:

plot(t,SignalModulated_D, 'r');

xlabel(TimeAxe);

legend('Modulated signal','Modulated signal \bfwith Doppler Effect');

title('Modulated signal with/without Doppler Effect');

%~~ SPECTRS ~~

figure(3);

hold on;

%Plot the SPECTR of initial signal

plot(FrequencyAxe,Plot_SpectrInitialSignal, 'm');

%Plot the SPECTR of the recieved signal

plot(FrequencyAxe,Plot_SpectrDemodulatedSignal, 'r');

hold off;

xlabel(TimeAxe);

legend('Spectr of the initial signal','Spectr of the demodulated signal');

title('Spectrs of the initial signal and demodulated signal');

Youssef Khmou
on 17 Mar 2013

Edited: Youssef Khmou
on 17 Mar 2013

hi Alex,

Your question is acceptable, you expect to visualize the Demodulated signal as the original, but the Doppler shift acts also as modulation, try this small example :

Fs=20;

f=5;

t=0:1/Fs:5;

y=sin(2*pi*t*f);

FF=fft(y);

FF2=circshift(FF,[0 10]);

y2=ifft(FF2);

subplot(1,2,1), plot(t,y),

title(' Original Signal');

subplot(122), plot(t,y2);

title(' Recovered Signal after shifting the Spectrum +> with 10 steps');

Then its alright :

Your method for Modulating /Demodulating is correct, but you can do the same with fmmod and fmdemod functions .

Last thing, there is a small error in the last graph , 3rd figure , the xlabel is FreqAxe

I hope this helps

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

Start Hunting!