Page 66 - Applied Numerical Methods Using MATLAB
P. 66

PROBLEMS   55
                 4
                   output                                 analog input
                 2                                   digital
                                                     output
                 0

                 −2
                                         input                          time
                 −4
                  −4     −2     0     2      4    0     2      4      6     8
                  (a) The input-output relationship of an ADC  (b) The output of an ADC to a sinusoidal input
                      Figure P1.10 The characteristic of an ADC (analog-to-digital converter).

                (b) Make a program that uses two ADC routines to find the output d for
                    the analog input data a = 3*sin(t) with t = [0:200]/100*pi and
                    plots a and d versus t to see how the analog input is converted into the
                    digital output by the ADC. The graphic result is supposed to be like
                    Fig. P1.10b.
            1.11 Playing with Polynomials
                (a) Polynomial Evaluation: polyval()
                    Write a MATLAB statement to compute
                                             8
                                     p(x) = x − 1    for x = 1         (P1.11.1)
                (b) Polynomial Addition/Subtraction by Using Compatible Vector Addi-
                    tion/Subtraction
                    Write a MATLAB statement to add the following two polynomials:

                                                           2
                                    4
                                                      3
                           p 1 (x) = x + 1,  p 2 (x) = x − 2x + 1      (P1.11.2)
                 (c) Polynomial Multiplication: conv()
                    Write a MATLAB statement to get the following product of polynomials:
                                     4      2
                             p(x) = (x + 1)(x + 1)(x + 1)(x − 1)       (P1.11.3)
                (d) Polynomial Division: deconv()
                    Write a MATLAB statement to get the quotient and the remainder of
                    the following polynomial division:
                                                 8
                                                    2
                                         p(x) = x /(x − 1)             (P1.11.4)
                 (e) Routine for Differentiation/Integration of a Polynomial
                    What you see in the below box is the routine “poly_der(p)”, which
                    gets a polynomial coefficient vector p (in the descending order) and
                    outputs the coefficient vector pd of its derivative polynomial. Likewise,
                    you can make a routine “poly_int(p)”, which outputs the coefficient
   61   62   63   64   65   66   67   68   69   70   71