Page 63 - MATLAB an introduction with applications
P. 63

48 ———  MATLAB: An Introduction with Applications


                       dn3=202
                       >> dn1=polyval(d,[–1])
                       dn1= 8
                   (c)  >> Hn10=nn10/dn10
                       Hn10=–0.1256
                       >> Hn5=nn5/dn5
                       Hn5=–0.0278
                       >> Hn3=nn3/dn3
                       Hn3=–0.2228
                       >> Hn1=nn1/dn1
                       Hn1=–0.1250
                   Example E1.8: Generate a plot of
                                   y(x) = e –0.7x  sin ωx
                   where ω = 15 rad/s, and 0 ≤ x ≤ 15. Use the colon notation to generate the x vector in increments of 0.1.
                   Solution:
                       >> x=[0:0.1:15];
                       >> w=15;
                       >> y=exp(–0.7*x)*sin(w*x);
                       >> plot(x,y)
                       >> title(‘y(x)=e^–^0^.^7^xsin\omegax’)
                       >> xlabel(‘x’)
                       >> ylabel(‘y’)
                                                        () =
                                                       yx   e − 0.7 x  sin ωx
                                      1
                                    0.8

                                    0.6
                                    0.4

                                    0.2
                                   y
                                     0

                                   –0.2
                                   –0.4

                                   –0.6

                                   –0.8
                                       0               5              10              15
                                                                x
                                                          Fig. E1.8









                   F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09
   58   59   60   61   62   63   64   65   66   67   68