The following MATLAB code simulates the effects happening to a signal transmitted over sea channel underwater cable. The changes happening to the signal is plotted at their respective stages.
19/05/2015 6:00 PM 'C:\Users\SAJIL\Documents\MATLAB\Seachannel.m'
Screen Display Specifications
scrsz = get(0,'ScreenSize');
P1=[40 500 scrsz(3)/3 scrsz(4)/3];
P2=[40 80 scrsz(3)/3 scrsz(4)/3];
P3=[600 500 scrsz(3)/3 scrsz(4)/3];
P4=[600 80 scrsz(3)/3 scrsz(4)/3];
P5=[1000 500 scrsz(3)/3 scrsz(4)/3];
P6=[1000 80 scrsz(3)/3 scrsz(4)/3];
P =[P1;P2;P3;P4;P5;P6];
c=['m' 'c' 'r' 'g' 'b' 'k'];
File Reading
[x, Fs] = audioread('I Love You Daddy.wav');
x=x(:,1);
N=length(x);
t=(0:(N-1))'/Fs;
Parameter specifications
A = 0.5;
G = 6;
i = 1;
Channel Model
while i<=G
Plot Signal
figure('position', P(i,:));
figure(i);
plot(t,x,c(i));
grid on
title(strcat('Transmitted Signal at Gate ', num2str(i)));
xlabel('Time in Seconds');
ylabel('Amplitude');
legend(strcat('Speech @ Gate ',num2str(i)));
Play back of Original
p= audioplayer(x,Fs);
play(p);
pause(max(size(x))/Fs);
Generate Guassian Noise Model
n= 0.5*rand(N,1)-0.5;
Signal Attenuation and Noise
x=x*A;
x=x+n;
i=i+1;
end
End of Program
No comments:
Post a Comment