12.2. Solved exercises
EXERCISE 12.1.
Write a MATLAB function to calculate the FRFT of a signal for a given order.
function FRFT = FracFR(x0,a); % Inputs: x0 - Original signal
% a - FRFT order % Output: FRFT - Transformed signal deltax = sqrt(length(x0)/2); phi= a*pi/2; N = fix (length (x0)/2); deltaxl = 2*deltax; alpha = 1/tan(phi); beta = 1/sin(phi); % Kernel implementation T = [-N:N-1]/deltax1; T = T(:);x0=x0(1:2*N); fl = exp(-i*pi*tan(phi/2)*T.*T); fl = f1(:);x = x0.*f1;clear T; t = [-2*N+1:2*N-1]/deltax1; hlptc = exp(i*pi*beta*t.*t); clear t; hlptc=hlptc(:); N2 = length(hlptc); N3 = 2* (ceil(log(N2+2*N-1) /log(2))); hlptcz= [hlptc;zeros(N3*N2,1)]; xz = [x;zeros(N3-2*N,1)]; Hcfft = ifft(fft(xz).*fft(hlptcz)); clear hlptcz; clear xz; Hc = Hcfft(2*N:4*N-1); clear Hcfft;clear hlptc; Aphi = exp(-i*(pi*sign(sin(phi))/4-phi/2))/sqrt(abs(sin(phi))); xx = [-N:N-1]/deltax1; fl = f1(:); FRFT = (Aphi*f1.*Hc)/deltax1;
EXERCISE 12.2.
This exercise aims to estimate the linear modulation rate of a chirp signal using the FRFT.
The MATLAB code below generates the analyzed signal.
t=0:255; x0=[ zeros (1,128),exp(j*2*pi*(.1*t+.0007*t.*2)),zeros(1,128)].';
The instantaneous frequency law and the modulation rate corresponding to this signal are calculated as follows:
LFT=.1+.0014*t; c=4*(LFT(256)-LFT(1)) ; % the modulation rate plot(t,LFI); xlabel('Temps'); ylabel('Normalized frequency'); title('Instantaneous frequency law');
Get Digital Signal Processing Using Matlab now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.