426
Practical MATLAB
® Applications for Engineers
Example 4.17
Let f(t) be the sum of two cosine waves with frequencies f 1 = 50 Hz and f 2 = 200 Hz, and
unit amplitudes.
Create the script fi le powers that returns over the range 0 ≤ t ≤ 15 s.
1. The average power of f(t) using
a. The norm function
b. The MATLAB functions sum and abs
2. The psd (power spectrum density) of f(t), using 1024 points, over the normalized
range 0 ≤ w ≤ 1
MATLAB Solution
% Script file: powers
% echo off;
t = 0:0.01:15; % time sequence
x = 3*cos(2*pi*50.*t);
y = cos(2*pi*200.*t); ft=x+y;
FIGURE 4.72
(See color insert following page 374.) Plots of i(t), v l (t), v r (t), and v c (t) on the same plot (top), and verifi cation of
KVL (bottom) of Example 4.16.
20
10
−10
−20
0
0
0.5
1
2
2.5
1.5
3
3.5
4
5
4.5
0
0
5
10
−10
−5
0.5
1
2
2.5
1.5
3
3.5
4
5
4.5
time (sec)
Amplitude (amps/volts)
Amplitude (amps/volts)
Plots of: i(t) versus t, v r (t) versus t, v l (t) versus t, and v c (t) versus t
[v r (t)+v l (t)+v c (t)] versus t (verifies KVL)
i(t)
v r (t)
v c (t)
v l (t)
CRC_47760_CH004.indd 426
CRC_47760_CH004.indd 426
7/28/2008 12:26:18 PM
7/28/2008 12:26:18 PM
Précédent

- 437/708

Suivant