Sea Channel Simulation with MATLAB

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'

%Version 1.0
%Sajil C. K., DCB, Uok.
%sajildcb@gmail.com
%This program Reads a speech wav file from Hard disk, then its applied
%though transformations in whcin it is attenuated and is affected by
%Gaussian noise. We can hear to the effects of these after each steps

Screen Display Specifications

%Measure screen size of PC
%Calculate position values of figure Windows

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); % Discard one channel
N=length(x);
t=(0:(N-1))'/Fs;

Parameter specifications

A = 0.5; %Channel attenuation value
G = 6; %Specify Number of Gate Breaks here
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