echo on % This script illustrates the distortion on a modulated pulse % transmitted down a bandpass channel. % Hit any key to continue pause tint = .03; % time interval over which pulse is defined fs = 10e3; % Set sampling Rate to about 10 times highest pulse freq. t = [-tint/2:(1/fs):(tint)]; % Define t-axis with a sampling rate fs len = length(t) % See how big time axis vector is % Hit any key to continue pause tau1 = 1/50; % Pulse duration case 1 tau2 = 1/100; % Pulse duration case 2 tau3 = 1/300; % Pulse duration case 3 w0 = 500*2*pi; % Modulating frequency and center % frequency of Transfer function a = 2*pi*100; % Transfer function gain parameter (a/b) b = 2*pi*100; % Transfer function bandwidth parameter figure(1); % Case 1 pulse s1 = tau1*rectw(t,tau1).*cos(w0*t); % create signal plot(t,s1); title('original signal, tau = 1/50') xlabel('seconds') grid fs1 = fft(s1,2*len); % Take the FT to create twice the frequency samples f = [-fs/2:(fs/(2*len)):(fs/2)-fs/(2*len)]; % Create Frequency Axis to % evaluate Transfer function p = j*2*pi*f; % Create jw values h = a*p ./ ( p.^2+b*p+w0^2); % Evaluate transfer function pd = fs1.*fftshift(h); % Must shift Frequency axis, multiply by % FT of pulse, and divide by interval % over which the pulse was defined figure(2) y1 = real(ifft(pd)); % Take inverse FT (then take real part). plot(t,y1(1:len)); title('channel output, tau = 1/50') xlabel('seconds') grid % Hit any key to continue pause; figure(1); % Case 2 pulse s2 = tau2*rectw(t,tau2).*cos(w0*t); plot(t,s2); title('original signal, tau = 1/100') xlabel('seconds') grid fs2 = fft(s2,2*len); % Take the FT to create twice the frequency samples p = j*2*pi*f; % Create jw values h = a*p ./ ( p.^2+b*p+w0^2); % Evaluate transfer function pd = fs2.*fftshift(h); % Must shift Frequency axis, multiply by % FT of pulse, and divide by interval % over which the pulse was defined figure(2) y2 = real(ifft(pd)); % Take inverse FT (then take real part). plot(t,y2(1:len)); title('channel output, tau = 1/100') xlabel('seconds') grid % Hit any key to continue pause; figure(1); % Case 3 pulse s3 = tau3*rectw(t,tau3).*cos(w0*t); plot(t,s3); title('original signal, tau = 1/300') xlabel('seconds') grid fs3 = fft(s3,2*len); % Take the FT to create twice the frequency samples p = j*2*pi*f; % Create jw values h = a*p ./ ( p.^2+b*p+w0^2); % Evaluate transfer function pd = fs3.*fftshift(h); % Must shift Frequency axis, multiply by % FT of pulse, and divide by interval % over which the pulse was defined figure(2) y3 = real(ifft(pd)); % Take inverse FT (then take real part). plot(t,y3(1:len)); title('channel output, tau = 1/300') xlabel('seconds') grid echo off