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

Linear_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 linear distortion channel, that is, a channel
% which disperses the signal in time domain only bu there is no effect on
% it in frequency domain. In this channel, the amplitude response is not
% constant.




% Fs is the sampling rate.
Fs = 100;

% Designing butterworth filter.
[num,den] = butter(2,.8);

% Time to sample the signal.
t = [0: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;

% Taking the value of constant magnitude 'k' of transfer function. 
k = 5;

% Transfer function 'h'
h = k;
% Modulating the input signal.
y = amodce(x,Fs,'pm');

% Demodulating and filtering the output signal.
zo =ademodce(y,Fs,'pm',num,den);
z = h.*zo;

% Plotting original signal and the recovered signal.
plot(t,x,t,z,'r--');

Contact us at files@mathworks.com