from Signal Distortion by Jawad Khalid
These m-files are generic implementation of distortion of signals.

Distortionless_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 distortionless channel, that is, a channel which
% allows a signal to pass without distortion. In this channel, the
% amplitude response |H(w)| is constant.





% 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 = 5;

% 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 function.
h = k;

% Taking convolution of delayed input signal 'x_td' and transfer function
% 'h' in time domain which interms become multiplication in frequency
% domain, i.e, X_td*H.
Y = fft(x_td)*fft(h);

% 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