PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 73


Example 1.13

Repeat Example 1.12, by creating the script fi le ortho_sin that verifi es that the sinusoids
constitute an orthogonal family by evaluating the following cases:
a. sin(nwot), sin(mwot)
b. sin(nwot), cos(mwot)
c. cos(nwot), cos(mwot)
d. sin(nwot), sin(nwot)
e. sin(nwot), cos(nwot)
f. cos(nwot), cos(nwot)
for an arbitrary n = 5 , m = 7 , and wo = 2 over the period T = 2 π/wo.
MATLAB Solution
% Script file: ortho _ sin
syms check _ a check _ b check _ c check _ d check _ e check _ f sins t
sins=sin(5*2*t)*sin(7*2*t);%wo=2,n=5,m=7
check _ a=int(sins,-pi/2,pi/2);
sins=cos(5*2*t)*sin(7*2*t);
check _ b=int(sins,-pi/2,pi/2);
sins=cos(5*2*t)*cos(7*2*t);
check _ c=int(sins,-pi/2,pi/2);
sins=sin(2*5*t)*sin(2*5*t);%wo=2,n=5,m=5
check _ d=int(sins,-pi/2,pi/2);
sins=sin(2*5*t)*cos(2*5*t);
check _ e=int(sins,-pi/2,pi/2);
sins=cos(2*5*t)*cos(2*5*t);
check _ f=int(sins,-pi/2,pi/2);
disp(‘*******************RESULTS*************************************’)
disp(‘The results for parts (a),(b),(c),(d),(e) and (f) are given below :’)
results=[check _ a check _ b check _ c check _ d check _ e check _ f];
disp(results)
disp(‘***************************************************************’)
Back in the command window, the script fi le ortho_sin is executed and the results are
indicated as follows:
>> ortho _ sin
***************************** RESULTS ********************************
The results for parts (a), (b), (c), (d), (e) and (f) are given below:
[ 0, 0, 0, 1/2*pi, 1/2*pi, 1/2*pi]
***********************************************************************
Note that the preceding results clearly indicate that the sinusoids constitute an orthogo-
nal family. Not a surprising result, since the complex exponentials constitute an orthog-
onal family (Example 1.12), and are related to the sinusoidals, by the Euler’s identities.

Example 1.14
Let f(t) be defi ned as

ft

t
t
tt

()

   
 

0105
10 5 0
10 0 10

for
for
−+ for







Free download pdf