You are on page 1of 6

TASK 1: CHANNEL SIMULATION

To perform channel simulation. Given a signal having multiple frequencies with


external Gaussian noise added to it. We require to remove the external noises
and find out the multiple input frequencies. Modulate these frequencies
through FSK and PSK modulation and find out different noises such as shipping
noise, thermal noise, wind noise, etc. for that particular frequency.

%TO COMPUTE FREQUENCIES OF A GIVEN NOISE SIGNAL(here 2 frequencies)


clc;
close all;
clear all;
fc1=input('Enter the freq of 1st Sine Wave carrier:');
fc2=input('Enter the freq of 2nd Sine Wave carrier:');
fp=input('Enter the freq of Periodic Binary pulse (Message):');
amp=input('Enter the amplitude (For Both Carrier & Binary Pulse Message):');
amp=amp/2;
t=0:0.001:1;
c1=amp.*sin(2*pi*fc1*t);
c2=amp.*sin(2*pi*fc2*t);
subplot(5,1,1);
plot(t,c1);
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
subplot(5,1,2);
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;
subplot(5,1,3);
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
for i=0:1000
if m(i+1)==0
mm(i+1)=c2(i+1);
else
mm(i+1)=c1(i+1);
end

end
subplot(5,1,4);
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave');
y=awgn(mm,10);
subplot(5,1,5);
plot(t,mm,t,y);
auto=fft(y);
absl=abs(auto);
desc=sort(absl,'descend');
Max1=desc(1);
Max2=desc(2);
Max3=desc(3);
Max4=desc(4);
s=sprintf('First Maximum is:%f',Max1);
disp(s);
s=sprintf('Second Maximum is:%f',Max2);
disp(s);
s=sprintf('Third Maximum is:%f',Max3);
disp(s);
s=sprintf('Fourth Maximum is:%f',Max4);
disp(s);
figure
plot(absl);
v=[0 30 0 700];
axis(v);
xlabel('Frequency(Hz)')
ylabel('FFT values')
[maxMi,indice]=max(absl);
s=sprintf('Max FFT Value:%f',maxMi);
disp(s);
s=sprintf('Frequecy Of input1(kHz):%f',indice-1);
disp(s);
indexes=find(absl==desc(3),1);
s=sprintf('Frequecy Of input2(kHz):%f',indexes-1);
disp(s);

%TO CALCULATE DIFFERENT LOSS AND NOISES

clc;

clear all;
close all;

%Process the recorded signal.


rec_signal= 'wave.wav';
[recordedSignal, Fs]=audioread(rec_signal);
[filename,noOfSamples]=wavinfo(rec_signal);
totalSamples=length(recordedSignal);
s = sprintf(' Frequency=: %f',Fs);
disp(s);
rec_sec = totalSamples / Fs;
nyquistFreq = Fs / 2;

%To Calculate Propagation delay and transmission delay


savefile = 'distance.dat';
Distance=input('Enter distance values:');
s=sprintf('Distances between Transmitter and Receiver:');
disp(s);
save Underwater_acoustics.mat;
clear;
load Underwater_acoustics.mat;
s = sprintf(' %f',Distance);
disp(s);
T1=28;
S=35;
D=1000;
%T=Temprature of Ocean in celcius , D=Depth in metres, S=Salinity in ppt
c_acc=(1449.2)+(4.6*T1)-(5.5*(1/100)*T1*T1)+(2.9*(1/10000)*T1*T1*T1)+((1.34-((1/100)*T1))*(S-35))
+(1.6*(1/100)*D);
c_basic=1500;
Prop_Delay=Distance/c_acc;
s = sprintf(' Speed Of Sound %f', c_acc);
disp(s);
s=sprintf('Propagation Delay:');
disp(s);
s = sprintf(' %f', Prop_Delay);
disp(s);
figure
plot(Distance,Prop_Delay);
xlabel('Distance');
ylabel('Propagation Delay');

%To calculate transmission loss


alpha=0.58;
%r=distance over which loss is calculated in metres
%alpha=attenuation coefficient db/m
Trans_Loss=(10*log(Distance))+(alpha*Distance);
s=sprintf('Transmission Loss:');
disp(s);
s = sprintf(' %f', Trans_Loss);
disp(s);
figure
plot(Distance,Trans_Loss);
xlabel('Distance');
ylabel('Transmission Loss');
%To calculate Ambient Noise
%due to turbulence,shipping,wind drven, thermal noise
%Fs=supply frequency,s=shipping factor(0-1),w=wind speed m/s
w=5.5555;
s1=0.5;
load wind_data.dat;

len=length(wind_data);

%To calculate Ambient Noise


freq=input('Enter Frequency values:');
s=sprintf('Frequency of the Wave:');
disp(s);
save Underwater_acoustics.mat;
clear;
load Underwater_acoustics.mat;
s = sprintf(' %f',freq);
disp(s);

nt=(17-(30*log(freq)))/10;
ns=(40+(20*(s1-0.5))+(26*log(freq))-(60*log(freq)))/10;
%nw=(50+(7.5*sqrt(w))+(20*log(Fs))-(40*log(Fs)))/10;
nth=(-15+(20*log(freq)))/10;
Nt=exp(nt);
Ns=exp(ns);
%Nw=exp(nw);
Nw=wind_data;
%s = sprintf(' %f', wind_data);
%disp(s);
%disp(wind_data);
%s = sprintf(' Length: %f', len);
%disp(s);
Nth=exp(nth);
Amb_Noise=Ns+Nt+Nth;
s = sprintf(' %f', Amb_Noise);
disp(s);
figure
plot(freq,Nt);
xlabel('Frequency');
ylabel('Turbulence Noise');
figure
plot(freq,Nth);
xlabel('Frequency');
ylabel('Thermal Noise');
figure
plot(freq,Ns);
xlabel('Frequency');
ylabel('Shipping Noise');

%TO PERFORM PSK MODULATION


clear all;
clc;
close all;

set(0,'defaultlinelinewidth',2);
A=5;
t=0:.001:1;
f1=input('Carrier Sine wave frequency =');
f2=input('Message frequency =');

%Carrier Sine
x=A.*sin(2*pi*f1*t);
subplot(3,1,1);
plot(t,x);
xlabel('time');
ylabel('Amplitude');
title('Carrier');

%Message signal
u=square(2*pi*f2*t);
subplot(3,1,2);
plot(t,u);
xlabel('time');
ylabel('Amplitude');
title('Message Signal');

%Sine wave multiplied with square wave


v=x.*u;
subplot(3,1,3);
plot(t,v);
axis([0 1 -6 6]);
xlabel('t');
ylabel('y');
title('PSK');

%TO PERFORM FSK MODULATION

clc;
close all;
clear all;
fc1=input('Enter the freq of 1st Sine Wave carrier:');
fc2=input('Enter the freq of 2nd Sine Wave carrier:');
fp=input('Enter the freq of Periodic Binary pulse (Message):');
amp=input('Enter the amplitude (For Both Carrier & Binary Pulse Message):');
amp=amp/2;
t=0:0.001:1;
c1=amp.*sin(2*pi*fc1*t);
c2=amp.*sin(2*pi*fc2*t);
subplot(4,1,1);
plot(t,c1)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
subplot(4,1,2)
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;
subplot(4,1,3)
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
for i=0:1000
if m(i+1)==0
mm(i+1)=c2(i+1);
else
mm(i+1)=c1(i+1);
end
end
subplot(4,1,4) %For Plotting The Modulated wave
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')

TASK 2: DATABASE OF EQUIPMENTS


To create a database of all the equipment used in Acoustic Test Facility(ATF).
Database must allow the user to view the details

You might also like