Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB Help only where the arrows are pointing: G, I, and K *** Please, I have a

ID: 1715462 • Letter: M

Question

MATLAB

Help only where the arrows are pointing: G, I, and K

*** Please, I have already done A thru F, H and J. Where I need help is with the section on MATLAB, which are G, I, and K. ***

First order linear systems

Laplace transform

Matlab - 'tf' and 'step' commands

Matlab - 'tf' and 'bode' commands

Ist and 2nd order linear DE's are the building blocks of linear system dynamics and are important by themselves but are also combined as components in more complex systems. This exercise is intended to let you get thoroughly familiar with the basic characteristics of these in both the time and frequency domain. Once you understand the nature of the general solution of these fundamental systems, you will find that you only need one or two parameters in order to completely understand the response of relatively complex systems (many times without any analysis whatsoever !!). We will be looking at many examples of modeling physical systems with a combination of 1st and 2nd order systems throughout the semester 1. Generic 1st Order Linear Systems As we have seen, the fundamental dynamics of many physical systems can be described by a 1st order D.E. of the form: Where X is some process variable of interest , such as temperature or voltage, Y is a forcing function (or "excitation") and w is a lumped positive constant which depends on the physical parameters of the system. The above equation is in normalized monic form which might be considered a sort of standard form. In a particular physical application, slightly different forms will arise but, as long as the dynamics can be described by a 1st order DE with constant coefficients, the basic dynamic response will have the same general characteristics A. Write the DE in the "s" domain using Laplace transforms. For practice, include the initial B. Draw a block diagram of the system using only integrators (ie no differentiators) and C. Write the transfer function X(s)/Y (s) for this system condition X, in the equation. constant parameters showing the input and initial condition. D. Factor as necessary and using PFE and the Laplace transform tables, write an expression in E. With wc -4 rad/s, write an expression in the time domain for the X(t) response to a step F. Use the final value theorem to predict the final value of X for E above the time domain for the response of X to a step input of magnitude Y assuming X 0 input, Y = 4 @ t-O G. with Xo-0. Sketch X vs t for E above and show the time constant 1/ on the plot. (hint: you can verify with Matlab using the "tf", and "step" commands) Treating the initial condition X, as a step input @ t=0 write the transfer function for x(s) / X.(s). (Note, the definition of a transfer function requires all IC's to be zero but this exercise demonstrates a practical method for getting the response to IC's by simply treating them as equivalent step inputs at the appropriate place in the system) H. I. With w.4 rad/s, write an expression for the time response, X(t) to a step input @t-0 with the initial condition that Xo2 and sketch the resulting X vs t. (hint use superposition with the results from Cand H above) J. Write expressions for the frequency response (ie magnitude and phase) of the transfer to denote the frequency of the input (ie Y(wi)) function from C above using With response from I above. Show the corner frequency, with Matlab using the "tf" and "bode" commands) K. = 4 rad/s, plot the magnitude and phase (in degrees) versus log of the frequency on the plots (hint: you can verify

Explanation / Answer

Though MATLAB is primarily a numerics package, it can certainly solve straightforward differential equations symbolically.1 Suppose, for example, that we want to solve the first order differential equation

y (x) = xy.

We can use MATLAB’s built-in dsolve().

The input and output for solving this problem in MATLAB is given below. >>y=dsolve(’Dy=y*x’,’x’) y = C2*exp(xˆ2/2) Notice in particular that MATLAB uses capital D to indicate the derivative and requires that the entire equation appear in single quotes. MATLAB takes t to be the independent variable by default, so here x must be explicitly specified as the independent variable. Alternatively, if you are going to use the same equation a number of times, you might choose to define it as a variable, say, eqn1. >>eqn1=’Dy=y*x’ eqn1 = Dy=y*x >>y=dsolve(eqn1,’x’) y = C2*exp(xˆ2/2)

To solve an initial value problem, say, equation (1.1) with y(1) = 1,

use >>y=dsolve(eqn1,’y(1)=1’,’x’) y = exp(xˆ2/2)/exp(1)ˆ(1/2)