% ===================================================== % % Herramientas de representación tiempo-frecuencia % Facultad de Ingeniería, Universidad de la República % % clase de práctico 1 % % autor: martín rocamora % % fecha: mayo 2017 % % ===================================================== addpath('./tftb-0.2/mfiles/') close all clear all % ---------------------------------------------------------------------------- % LINEAR FREQUENCY MODULATION % ---------------------------------------------------------------------------- % generate a chirp signal n_points = 128; fmin = 0.0; fmax = 0.5; signal = fmlin(n_points, fmin, fmax); % noisy chirp % signal = sigmerge(signal, noisecg(n_points), 0); % compute the energy spectrum of the chirp dsp1 = fftshift(abs(fft(signal)).^2); % compute Wigner-Ville distribution of the chirp. [tfr,t_tfr,f_tfr] = tfrwv(signal); % ---------------------------------------------------------------------------- % PLOTS % ---------------------------------------------------------------------------- figure() % subplot(2, 1, 1) plot(real(signal)) xlim([0, n_points]) title('Linear Frequency Modulation') ylabel('Real Part') xlabel('Time') grid() figure() % subplot(2, 1, 2) plot((-n_points/2:n_points/2-1)/n_points, dsp1) xlim([-0.5, 0.5]) title('Spectrum') ylabel('Squared modulus') xlabel('Normalized Frequency') grid() figure() % imagesc(t_tfr, f_tfr, tfr) % axis xy levels = 5; contour(t_tfr, f_tfr, tfr, levels) xlabel('Time') ylabel('Normalized Frequency')