PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

372 Practical MATLAB® Applications for Engineers


0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
10 −^2

10 −^1

100

Pxx  X power spectral density

Frequency

FIGURE 4.22
Plot of psd of ynoise of R.4.132.


R.4.131 The MATLAB function specplot(p) uses the output of the function p=spectrum(x,y)
(R.4.126) to return the plots of Pxx, Pyy, magnitude[Txy], phase[Txy], and Cxy.


R.4.132 The script fi le specgrph illustrates the use of the function spectrum, with input argu-
ments ynoise and mtlb, defi ned in R.4.124 and R.4.125.


MATLAB Solution
% Script file: specgrph
% load speech file mtlb
% echo on;
load mtlb;
x =1:4001; % time sequence
noise = rand(1,4001)*2; % noise sequence
y = 3*cos(2*pi*x/2000);
ynoise = 3*cos(2*pi*x/2000)+noise;
disp(‘*********************************************’)
disp(‘*********************************************’)
disp(‘Press Enter to get the plots of:’)
disp(‘Pyy,mag(Txy),angle(Txy),Cxy’)
disp(‘*********************************************’)
disp(‘*********************************************’)
spectrum(ynoise,mtlb)

The script fi le specgrph is executed and the resulting plots are shown in Figures 4.22
through 4.26.


R.4.133 It is often required to analyze a given system transfer function H(s), in terms of
its circuit elements, given by impedances. Review of simple network structures,
expressed in terms of their impedance (in ohms), denoted by Z(s) are shown in
Figure 4.27, with the corresponding equations. These simple building blocks when
interconnected are used to build complex networks.

Free download pdf