Você está na página 1de 4

CHAPTER 3

LEARNING OBJECTIVES : In this chapter our aim would be to use MATLAB to do the following signal operations Finding the energy and power of signals. Folding, scaling, shifting a function. Finding odd and even components. Convolving two functions. POWER AND ENERGY OF SIGNALS The energy of a signal is defined as

lt T > | f (t ) | 2 dt
T

The power of a signal(exists only for periodic signals) is the time average of energy

ltT >

1 | f (t ) |2 dt 2T T

Using the int and limit function in MATLAB the energy and power of signals can be found out. limit FUNCTION The limit command is used to find out the limit of a symbolic expression. The general syntax is value=limit(F,x,a) where F is the symbolic expression ,x is the free variable/symbol and a is the limit ie value =lt x a F If there is only one symbolic variable then the parameter x can be omitted ie value=limit(F,a) .

limit(F) uses a = 0 as the limit point. eg : limit(sin(x)/x) returns 1 limit((1+2*t/x)^(3*x),x,inf) returns exp(6*t) eg: Using the definition of power let us find the power of sin(t) syms t y= cos(t) syms T z=int(y*y,-T,T) w=z/(2*T) u=limit(w,T,inf) simplify FUNCTION Another useful function is the simplify function which is used to simplify symbolic expressions. The syntax is simplify(S) where S is a symbolic expression. eg: simplify(sin(x)^2 + cos(x)^2) is 1 . FOLDING, SHIFTING AND SCALING SIGNALS In the previous chapter we have seen how to define a unit step function using the zeros and ones function. Another method would be to use a user defined function Let this function be called u. Then u.m would look like function[x]=u(t) l=length(t); for i=1:l; if t(i)>0

x(i)=1; else x(i)=0; end end Defining a unit step function is important because once a unit step function has been defined any other function can be expressed in terms of a unit step. eg: A triangular gate is defined using unit step as (t)=(1+2t)(u(t+1/2)-u(t))+(1-2t)(u(t)-u(t-1/2)) To fold a function about y axis all we have to find out f(-t) .We already have the expression for f(t).By just replacing t by t we get f(-t) (Remember strrep function) Similarly f(at) is be found by replacing t by at .f(at-b) is be found by replacing t by (at-b) ODD AND EVEN COMPONENTS OF A SIGNAL Any signal f(t) can be split up int an odd component fo(t) and an even component fe(t). The odd component is given by fo(t)=1/2[f(t)-f(-t)]. The even component is given by fe(t)=1/2[f(t)+f(-t)]. One can easily verify that f(t)=fo(t)+fe(t). conv FUNCTION The conv function is used to convolve two functions in MATLAB The syntax is C=conv(a,b) Here a and b are vectors of same length. The length of the convolved function is given by length(C)=length(a)+length(b)-1 The conv function is a function for discrete convolution and hence may yield slightly different results when used as an approximation to continuous convolution. The convolved function may be scaled in magnitude. To correct this just multiply by the spacing of the time vector. You will come to the reason later!!

eg: The code to convolve two gate functions is given below x1 = -2 : 0.01 : 0 ; x2 = 0.01 : 0.01 : 2 ; x3 = 2.01 : 0.01 : 4 ; x = [ x1 x2 x3 ] ; y1 =[ zeros(size(x1)) ones(size(x2)) zeros(size(x3)) ]; plot (x , y1); y2 = [ zeros(size(x1)) ones(size(x2)) zeros(size(x3)) ]; figure, plot (x, y2); x= -4 : 0.01 : 8 ; z = 0.01*conv (y1,y2) ; figure, plot (x,z);

Você também pode gostar