You are on page 1of 7

Lab 6

To study transmission impairment


Task 1:
Design a periodic signal(square wave) having 25
hormonics with fundamental frequency of ½ hertz
by using forier series equation
t=linspace(0,4*pi,1000)
f=0.1;
A=3;;
ftn=0;
for k=1:2:6;
ftn=ftn+(4*A/(k*pi))*sin(2*pi*k*f*t);
end
plot(t,ftn);
title('square wave')
xlabel('time');
ylabel('amplitude');
grid on;
Task 2
by using built in fun
%y=A*square(2*pi*f*t);
%subplot(2,1,2);
grid on;
%plot(t,y);
Task 3
How to generate noise:
Generate a column vector of length 512 containing real
noise of power 3dbW across 50ohm load
Y=wgn(M,N,P,Imp)
Y=wgn(512,1,3,50);
Hist(y)
Hist(y,50);
Task4
To generate sine wave having f=0.3 hz and noise so that
SNR becomes 10 db .plot original and noisy signal.
t=linspace(0,4*pi,1000);
f=0.5;
x=sin(2*pi*f*t);
y=awgn(x,10)
subplot(2,1,1);
plot(t,x);
subplot(2,1,2);
plot(t,y);
Task 5
To generate square wave having f=0.3 hz and noise so
that SNR becomes 10 db .plot original and noisy signal.
t=linspace(0,4*pi,1000);
f=0.1;
x=square(4*2*pi*f*t);
y=awgn(x,15)
subplot(2,1,1);
plot(t,y);
subplot(2,1,2);
plot(t,x);

Lab task 6
Delay distortion:
Change in shape of a signal
Take any 3 components of a square wave in task 1
and do it manually
compare it will be different
y1=(4*A/pi)*sin(2*pi**f*t);
Y2=(4*A/(3*pi))*sin(2*pi*3*f*t+pi/4);
Y3=(4*A/(5*pi))*sin(2*pi*5*f*t-pi/6);
Y=y1+y2+y3;
Subplot(2,1,2);
Plot(t,y)

Lab task 7:
Matlab codes that circulates amount of attenuation if
signal amplitude is reduced to ½ of original amplitude.
Some commands before performing this lab to
understand it.
4sin(wt)(p1)……………..its half is 2sin(wt)(p2)
Attenuation=10log(p2/p1)
P=1/N∑(n=0 to N=1) |x[n]|^2
Now how to insert it in Matlab?
=sum(x.*xconj(x)/length(x))
Let x=[1 2 3]
X^2=]1 4 9]
x.*x=element to element multiplication
sum(x)=summation=6
x.*x=[1 4 9]
let x= 2+5j
x*conj(x)=2^2+5^2
Now coming to our programe:
t=linespace(0,4*pi,1000);
f=0.1;
x=4*sin(2*pi*f*t);
p1=sum(x.*xconj(x)/length(x));
x2=2sin(2*pi*f*t);
p2=sum(x2.*x2conj(x2))/length(x2));
att=10log(p2/p1);
power will be negative
if A varies ¼ p=-6db
A=1/8 p=-9db

You might also like