Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

LAB 6: P /E S S P: Ower Nergy of The Ignals and Ystem Roperties

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

LAB 6: POWER/ENERGY OF THE SIGNALS AND SYSTEM

PROPERTIES
CLO5: USE MODERN TOOL (E.G. MATLAB) FOR SIGNAL REPRESENTATION,
VISUALIZATION AND PROCESSING IN BOTH TIME AND FREQUENCY DOMAIN.

Function Handle
A function handle is a MATLAB data type that holds information to be used referencing a function.
When you create a function handle, MATLAB captures all the information about the function that it
needs to execute it later on. Once the handle is created, it can be used to execute the function at any
time.

Function handles are defined using the @ operator. Consider the following example:

>> f = @(x) x^5-3*x

f =

function_handle with value:

@(x)x^5-3*x

This tells MATLAB to create a function for which x is the variable (this is what the @(x) does) and
for which the rule is x^2-x. Here are some things we can do with function handles. We can plug things
in:
>> f(3)

ans =

234

Differentiation and Integration


We cannot simply do diff(f) because diff doesn't work as-is on function handles. However, if we define
x as symbolic then Matlab will accept diff. What's happening here is that f is a function handle but
f(x) is symbolic because symbolic x is plugged in:

>> clear all;


>>f = @(x) x^5-3*x;
>>syms x;
>>diff(f(x))

ans =

5*x^4 - 3

MCT-301L: Signals and Systems


Department of Mechatronics and Control Engineering, U.E.T Lahore
AND

>>diff(f(x),2)

ans =
20*x^3

Also, provided x is symbolically defined then the following will work:


>>diff(f,x,2)

ans =
20*x^3

Integration works the same way in that int(f) and int(f,1,2) will work provided x is symbolic:
>>clear all;
>>f = @(x) x^5-3*x;
>>syms x;
>>int(f(x))

ans =
(x^2*(x^4 - 9))/6

AND

>>int(f(x),1,2)

ans = 6

will work fine, as will:

>>int(f,x,1,2)

ans = 6

MCT-301L: Signals and Systems


Department of Mechatronics and Control Engineering, U.E.T Lahore
Calculate Power and Energy of a Signal:
The power of signal (with independent time variable n) is given by the averaging the summation:
𝑛=𝑁
1
𝑃(𝑥[𝑛]) = 𝑙𝑖𝑚 ∑ |𝑥[𝑛]|2
𝑁→∞ 2𝑁 + 1
𝑛=−𝑁
while energy is:
𝑛=𝑁

𝐸(𝑥[𝑛]) = 𝑙𝑖𝑚 ∑ |𝑥[𝑛]|2


𝑁→∞
𝑛=−𝑁

While it is easier to implement summation, the limit part is implemented by setting N to some number
e.g. 100 or 1000 and then increasing it gradually. When N is steadily increased, if the power of the
signal approaches constant value while its energy keeps increasing, it is a power signal. On the other
hand, if the energy of signal approaches constant value and its power approaches zero, it is energy
signal. Otherwise the signal can be classified as neither power nor energy signal.

TASK 1:
Calculate power and the energy of the following signals and classify them as power signal, energy
signal or neither power nor energy signal. You have to plot the Power and Energy graph and
also find the mean Power and Energy:
𝜋 𝜋
a) 𝑐𝑜𝑠 ( 5 𝑛 − 15)
b) 0. 8|𝑛|
2𝜋
c) 𝑒 𝑗 10 𝑛
d) (−1)𝑛
𝑛
𝜋
e) 𝑒 100 𝑐𝑜𝑠 (6 𝑛)

y = @ (n) cos (n); %Replace cos(n) with


N = 100;
for i = 1:1000
P (i) = 0 ; E (i) = 0;
for m = -N:N
%Complete the Logic
end
P (i) = %Complete the Logic
N = N + 10;
end
i = 1: 1000;
mean (P)
mean (E)
subplot (2, 1, 1); plot (i,P,'r');
xlabel ('N'); ylabel ('Power');
subplot (2, 1, 2);
plot (i,E,'g');
xlabel ('N'); ylabel ('Energy');

TASK 2:

Repeat Task 1 for Continuous-Time signals.

MCT-301L: Signals and Systems


Department of Mechatronics and Control Engineering, U.E.T Lahore
Verifying System Properties:

Task 3:
Consider the discrete-time system y[n] = n x[n]. Use MATLAB to verify whether the system is Time
Invariant or not.

a. Assume that the input to this system is x[n] = u[n]-u[n-4].


b. Sketch the input x[n].
c. Sketch the output y[n] for input x[n].
d. Let x1[n] = x[n-2]. Sketch the input x1[n].
e. Sketch the output y1[n] for input x1[n].
f. Sketch the output y[n-2].
g. Is the output y1[n] equal to y[n-2]? Is system TI?

Task 4:

Repeat Task3 for the system y[n] = (x[n+1] + x[n] + x[n-1])/3 (It is moving average filter with M=1)

MCT-301L: Signals and Systems


Department of Mechatronics and Control Engineering, U.E.T Lahore

You might also like