Anda di halaman 1dari 9

Experiment No.

Aim : Write MATLAB Codes for finding the signal energy or power

Theory:

Energy and Power Signals:


The total energy and the average power normalized to unit resistance of
any arbitrary signal x(t) can be defined as

E = lim ∫|x(t)|2dt, joules


T→∞

P = lim(1/2T) ∫|x(t)|2 dt, watt


T→∞

The energy signal is one which has finite energy and zero average
power, i.e. x(t) is anenergy signal if 0<E<∞ , and P=0.

The power signal is one which has finite average power and infinite
energy, i.e. 0<P<∞ , and E= ∞ .

If the signal does not satisfy any of these two conditions, then it is
neither energy nor a power signal.
INLAB EXERCISE:

Q.1.Write MATLAB Codes for finding the signal energy or power


(i) x(t) = tri ((t-2) /5)
(ii) A periodic signal of fundamental period of 10 describe over one
period by x(t) = -2*t , -4 < t < 4

Source code:

t=-10:.001:10;
c=ramp(t);
u=(1-((t-2)./5)).*(((t-2)./5)>=0 & ((t-2)./5)<1)+(1+((t-2)./5)).*(((t-
2)./5)>-1 & ((t-2)./5)<0)+0*(((t-2)./5)>1 & ((t-2)./5)<-1);
x=u.*u;
plot(t,x);
grid on;
hold on;
z=trapz(t,x);
p=z/20;
1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Energy=3.333,
(ii) Source code:
t=-5:0.01:5;
x=-2.*t.*(abs(t)<4);
plot(t,x.^2);
e=trapz(t,x.^2)
p=e./10

70

60

50

40

30

20

10

0
-5 -4 -3 -2 -1 0 1 2 3 4 5

E=170.024 , P=17.024
Post lab Exercise:

Q1. Using MATLAB find the signal power of x(t)=Acos(2 f t + θ) .


Assumed values of unknown
A=5, f=2, θ=30

When limit is known, under finite condition

Source code:
t=-5:.1:5;
x=5*cos(2*180*2.*t+30);
y=x;
plot(t,y.^2);
e=trapz(t,y.^2);
p=e/10;

25

20

15

10

0
-5 -4 -3 -2 -1 0 1 2 3 4 5
energy=122.70, power=12.27
Q2. Find the signal energy and power:
(i) x(t) = u(t)

Source Code:
t=-5:.01:5;
u =1.*(t>0)+ 0.*(t<0);
v=u.^2
plot(t,u)
z = trapz(t,v)

When time t -> ∞


Energy of signal = ∞
Power of signal = 0.5
Hence the above signal is power signal.
(ii) x (t) = rect(t)

Source Code:
t=-5:.001:5;
u =1.*(t+2>0)- 1.*(t-2>0)
v=u.^2
plot(t,u)
z = trapz(t,v)

For the interval -2 < t < 2

Energy of signal = 4
Power of signal = 0

Hence the above signal is energy signal


(iii) x [n] =A
For the interval -5 < n < 5
Assuming A = 5

Source Code:
n=-5:5;
u =5.*(abs(n)<=5)
v=u.^2
stem(n,u)
stem(n,v)

4.5

3.5

3
y axis --> x[n]

2.5

1.5

0.5

0
-5 -4 -3 -2 -1 0 1 2 3 4 5
x axis --> n

For the interval of x[n] = A to be -∞ < n < ∞

Energy of signal = ∞
Power of signal = A2/2
Hence the above signal is power signal
(iv) x[n] = Aδ[n]

Assuming A=3
Source Code:
n=-5:5;
u =3.*(n==0)
v=u.^2
stem(n,u)
hold on
stem(n,v)
'* ' --> 'x [n ] a n d '@ ' --> x [n ]* x [n ]

0
-5 -4 -3 -2 -1 0 1 2 3 4 5
x axis --> n

For the signal x(t) = Aδ[n]

Energy of signal = A2
Power of signal = 0
Hence the above signal is energy signal
Learning Outcome:
This lab was useful to learn how to calculate the energy and power of a given signal
when the signal is periodic as well as when it is aperiodic.

With the help of this lab we came to know that the periodic signals are always power
signal and finite duration signals are energy signals.

It was also helpful in learning various matlab functions such as “hold on” and “trapz”
function.

Anda mungkin juga menyukai