Page 109 - Singiresu S. Rao-Mechanical Vibrations in SI Units, Global Edition-Pearson (2017)
P. 109

106    Chapter 1   Fundamentals oF Vibration
                                               x(t)   A*t/tau         One term              Two terms
                                          1                    1.5                    1

                                         0.8                                         0.8
                                                                1
                                         0.6                                         0.6
                                       x(t)                    0.5
                                         0.4                                         0.4
                                                                0
                                         0.2                                         0.2
                                          0                   0.5                     0
                                           0       1        2    0       1        2    0       1        2
                                                    t                     t                    t
                                                Three terms           Four terms
                                          1                     1

                                         0.8                   0.8
                                         0.6                   0.6
                                       x(t)
                                         0.4                   0.4
                                         0.2                   0.2

                                          0                     0
                                           0       1        2    0       1        2
                                                    t                     t
                                   Equations (E.1) and (E.2) with different numbers of terms.



                                   Solution:  A MATLAB program is written to plot Eqs. (E.1) and (E.2) with different numbers of
                                   terms as shown below.

                                                %ex1_21.m
                                                %plot the function x(t) = A * t / tau
                                                A = 1;
                                                w = pi;
                                                tau = 2;
                                                for i = 1: 101
                                                   t(i) = tau * (i-1)/100;
                                                   x(i) = A * t(i) / tau;
                                                end
                                                subplot(231);
                                                plot(t,x);
                                                ylabel('x(t)');
                                                xlabel('t');
                                                title('x(t) = A*t/tau');
                                                for i = 1: 101
                                                   x1(i) = A / 2;
                                                end
                                                subplot(232);
                                                plot(t,x1);
                                                xlabel('t');
                                                title('One term');
   104   105   106   107   108   109   110   111   112   113   114