Parameters Setting - Signal.: Clear Close CLC

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Table of Contents

........................................................................................................................................ 1
PARAMETERS SETTING - SIGNAL. ................................................................................... 1
PARAMETERS SETTING - SAMPLING. .............................................................................. 1
AXIS GENERATION - RANGE TIME. ................................................................................. 1
AXIS GENERATION - RANGE FREQUENCY. ..................................................................... 1
SIGNAL GENERATION - FFT. ........................................................................................... 1
SIGNAL GENERATION - PRINCIPLE OF STATIONARY PHASE (POSP). ............................... 2
PLOTTING - LINEAR FM SIGNAL. .................................................................................... 2

clear all;
close all;
clc;
%

PARAMETERS SETTING - SIGNAL.


A = 1; %Amplitude.
Tp = 7.5E-6; %Pulse duration, [s].
B = 1E8; %Bandwidth, [Hz].
CS = +1; %Chirp sign: '+1' for up-chirp and '-1' for 'down-
chirp'.
%

PARAMETERS SETTING - SAMPLING.


OS = 1.2; %Oversampling factor.
Fs = OS*B; %Sampling Rate, [Hz].
Ts = 1/Fs; %Sampling Time, [s].
%

AXIS GENERATION - RANGE TIME.


NoFT = Fs*Tp;
t = 0:Ts:(NoFT - 1)*Ts; %Range Time, [s].
t = t - median(t); %Range Time centered wrt '0', [s].
%

AXIS GENERATION - RANGE FREQUENCY.


f = 0:(1/NoFT):(1 - 1/NoFT); %Normalized Range Frequency.
f = f - 0.5;
f = f*Fs;
%

SIGNAL GENERATION - FFT.


K = CS*(B/Tp); %Chirp rate.

1
Phi = pi*K*t.^2; %Istantaneous phase.
Frq = K*t; %Istantaneous frequency.
s = A*exp(+1i*Phi); %Chirp signal.
S = fft(s, NoFT);
S = fftshift(S);
%

SIGNAL GENERATION - PRINCIPLE OF


STATIONARY PHASE (POSP).
W = abs(f) <= B/2;
A = sqrt(1/K);
P = sign(2*pi*K)*pi/4 - pi*((f.^2)/K);
S_POSP = A*exp(1i*P);
S_POSP = S_POSP.*W;
%

PLOTTING - LINEAR FM SIGNAL.


figure;
subplot(2, 2, 1);
plot(t, real(s));
xlim([t(1) t(end)]);
grid on;
xlabel('Time [s]');
ylabel('Amplitude');
title('Real part of signal');
%
subplot(2, 2, 2);
plot(t, imag(s));
xlim([t(1) t(end)]);
grid on;
xlabel('Time [s]');
ylabel('Amplitude');
title('Imaginary part of signal');
%
subplot(2, 2, 3);
plot(t, Phi);
xlim([t(1) t(end)]);
grid on;
ylim([min(Phi) max(Phi)]);
xlabel('Time [s]');
ylabel('Phase [rad]');
title('Istantaneous phase of signal');
%
subplot(2, 2, 4);
plot(t, Frq);
xlim([t(1) t(end)]);
grid on;
ylim([min(Frq) max(Frq)]);
xlabel('Time [s]');

2
ylabel('Frequency [Hz]');
title('Istantaneous frequency of signal');
%
%
M = ceil(max(10*log10(abs(S)))) + 3;
figure;
subplot(2, 2, 1);
plot(f, 10*log10(abs(S)));
grid on;
xlim([f(1) f(end)]);
ylim([M-20 M]);
xlabel('Frequency [Hz]');
ylabel('Amplitude');
title('Magnitude of spectrum - DFT');
%
subplot(2, 2, 2);
plot(f, angle(S));
grid on;
xlim([f(1) f(end)]);
xlabel('Frequency [Hz]');
ylabel('Angle [rad]');
title('Phase of spectrum - DFT');
%
subplot(2, 2, 3);
plot(f, 10*log10(abs(Fs*S_POSP)));
grid on;
xlim([f(1) f(end)]);
ylim([M-20 M]);
xlabel('Frequency [Hz]');
ylabel('Amplitude');
title('Magnitude of spectrum - POSP');
%
subplot(2, 2, 4);
plot(f, angle(S_POSP));
grid on;
xlim([f(1) f(end)]);
xlabel('Frequency [Hz]');
ylabel('Angle [rad]');
title('Phase of spectrum - POSP');
%
%
figure;
plot(f, angle(S));
grid on;
hold on;
plot(f, angle(S_POSP), 'r');
%% There is no matching between POSP's phase and theoretical
phase.
xlim([f(1) f(end)]);
xlabel('Frequency [Hz]');
ylabel('Angle [rad]');
legend('FFT', 'POSP');
title('Phase of spectrum');
%

3
Out = S.*conj(S_POSP);
%
figure;
subplot(2, 1, 1);
plot(f, angle(Out));
grid on;
xlabel('Frequency [Hz]');
ylabel('Angle [rad]');
subplot(2, 1, 2);
plot(f(1:(end-1)), diff(angle(Out)), '.');
grid on;
xlabel('Frequency [Hz]');
ylabel('Diff [rad]');
%

4
5
Published with MATLAB® R2016a

You might also like