Question

QUESTION 9

To find the step response of the system we need to examine the output of the system when the input is set to be a step function. Matlab represents a step function with syntax

>> heaviside(t)

To equation to solve is thus now

>> eqn2 = 3*diff(yt) + y(t) == heaviside(tx

Use dsolve to solve this ODE, again assuming that the output is 0 before time 0. Compre the equation for the output you have now to the equation you had earlier. Note that our Maths is representing exactly the same

system, we've just the x(t)

our new input, a step in this case.

Next, plot the response using the fplot command.

The DC steady state gain is defined as the ratio between the output and the input, when the response is in steady state.

By examining your plot, what is the DC steady state gain of this system?

You may like to plot your response for different amounts of time to see what value the response is trending to. (It should be easy to spot the exact value, it doesn't need many decimal places.) You might also like to

think about why we are using a step input to work out the gain, rather than an impulse input as in the previous questions. Discuss with a demonstrator to make sure your thinking is correct.

QUESTION 10

Before proceeding you may like to reset Matlab so that you don't have too many variables with the same name and to tidy up the display. You can do this with:

>> clear % deletes all variables in the Matlab workspace

>> close all % closes any open figures that you have displayed

>> clc % deletes anything currently displayed in the command window

You will then need to enter

>> syms y(t):

again to tell Matlab the name of the variable we want to use in our ODE.

We can use the dsolve tool to solve many ODES, including higher order ones. As you've already seen, a first order derivative is entered as

>> diff(y,t)

Higher order derivatives can be entered by providing a third argument, for the number of times to take the derivative. A second derivative is thus

>> diff(y,t,2)

To analyse the second order ODE

d²y (1)

+0.3- +2y (1)=34x(1)

dy (1)

dt

for the case when the input signal x(t) is a step we therefore set the equation to solve to be

eqn3 = diff(y,t,2) + 0.3*diff(y,t) + 2*y(t) == 34 * heaviside(t);

As this is a second order ODE we now need two initial conditions in order to be able to solve it. Again we'll assume the system is at rest before time = 0. We'll thus say that the value of the

output and the derivative of the output are 0 at time-1. (Again we could have taken any negative time, we've just picked-1 arbitrarily here.) We set these conditions as:

>> cond1 = y(-1) == 0;

>> Dy = diff(y,t); % giving dy/dt a name to make it easier to assign a value to it on the next line

>> cond2 = Dy(-1) == 0;

>> conds = [cond1 cond21: % combine the conditions into one variable

Question image 1