from
Signal Distortion
by Jawad Khalid
These m-files are generic implementation of distortion of signals.
|
| Multipath_Distortion_Channel.m |
% Group Members :-
% Abuzar Shazli (Roll # 368)
% Rizwan Kausar (Roll # 375)
% Sarmad Nazir Khawaja (Roll # 403)
% Jawad Akbar Khalid (Roll # 413)
% Jawad Ahmed Sheikh (Roll # 449)
% This m-file represents a multipath distortion channel.
% Fs is the sampling rate.
Fs = 100;
% Generating time vector 't'.
t = [-5:1/Fs:10];
% Generating input zero vector 'x' equal to the size of the time vector
% 't'.
x = zeros(length(t));
% Finding the corresponding positions.
a = find(t==4);
b = find(t==6);
% Generating a pulse at the points 'a' and 'b'.
x(a:1/Fs:b) = 1;
% Generating input zero vector 'x' equal to the size of the time vector
% 't'.
x_td = zeros(length(t));
% Taking the value of constant magnitude 'k' of transfer function.
k = 10;
% Taking the value of time delay 'td' of the input signal as input from
% user.
td = input('Enter time delay constant td :: ');
% Finding the corresponding positions.
c = find(t==4-td);
d = find(t==6-td);
% Generating a pulse at the points 'a' and 'b'.
x_td(c:1/Fs:d) = 1;
% Magnitude of transfer functions.
h1 = 1;
h2 = k;
% Taking convolution of delayed input signal 'x_td' and transfer function's
% 'h1' and 'h2' in time domain which interms become multiplication in frequency
% domain, i.e, X_td*H.
Y1 = fft(x_td)*fft(h1); % Output of 1st path.
Y2 = fft(x_td)*fft(h2); % Output of 2nd path.
% The output of the multipath distortionless channel.
Y = Y1+Y2;
% Changing output from frequency domain to time domain.
y = ifft(Y);
% Plotting output signal 'y'.
plot(t,x,t,y,'r--');
|
|
Contact us at files@mathworks.com