# Initial Conditions for first derivative defined as a transfer function

7 views (last 30 days)
Rob Robinson on 30 Jun 2020
Commented: Rob Robinson on 14 Jul 2020
I have defined defined a second order underdamped system in the time domain with a non zero initial condition for Y'(t) but can not implement this in the laplace domain.
My transfer function
In the time domain I have defined my function:
with initial conditions:
Y(0) = 0
Y'(0) = D
when I set D to zero I get the same result from the two methods so I am confident that I have correctly defined the transfer function but I do not understand how I can implement this into my simulink model such that D is non zero.
I tried using the tf2ss but even without trying to apply any initial conditions the output curve is different? I have also tried using the transfer function with initial states but with no luck.
sys = tf(numerator,denominator);
stepplot(sys)
[A,B,C,D] = tf2ss(numerator,denominator);
Any help is appreciated!

Paul on 8 Jul 2020
What exactly are you trying to do? Generate the output of your second order system in response to a step input with a non-zero initial condition on the derivative of the output?
Is Y(t) as defined above the output of the system in response to a particular type of input? If so, what is that input? It would be helpul if you showed the code for the "two methods" so we can see exactly what you're trying to do.
Rob Robinson on 13 Jul 2020
Yes that's exactly it, I have created a block diagram of my state space model (see attached) which hopefully makes it clearer (Method 1). My A,B,C&D matricies change over time and so I can't use the standard block state space block which would allow for the entry of initial conditions. Essentially my question is how can I implement the initial conditions defined as a block parameter in the simulink state space block into the block diagram I created that is attached thus enabling me to have initial conditions and matricies that vary over time.
Yes, Y(t) is defined as above, my input is a constant value.
Method 2 is solving the differential equation below with the defined initial conditions. The Y(t) function I wrote above is the same as the solution to this equation just in a neater form whereby the coefficients X_1 and X_2 are dependent on the initial conditions of the output. This method is working as I would like and I am trying to replicate in state space form (Method 1).
Hopefully this makes what I am trying to achieve a little clearer.
odeI = (diff(z,t,2)*capacitance*inductance)+(diff(z,t,1)*inductance) - vSource == 0;
cond1 = z(0) == 0;
cond2 = Dz(0) == vStart/inductance;
conds = [cond1,cond2];
iSol(t) = dsolve(odeI,conds);

Paul on 14 Jul 2020
Rob,
a. from your clarificatiion, it sounds like you really have a linear, time varying system. So you don't have a transfer function representation, or any linear time invariant (LTI) representation.
b. I'm still confused by your Y(t). It kind of looks like the output of an LTI system, unless the alpha and wd are really functions of t, but just not shown as such. Also, Y(t) seems to be missing the effect of the input vSource. As you say, X1 and X2 are determined by initial conditions on y(t) and y'(t), but the system input should also have an effect on the output as well.
c. From what I gather, you have a second order, linear, time varying differential equation of the form:
z''(t)*Capacitance(t)*Inductance(t) + z'(t)*Inductance(t) = vSource(t) (where vSource(t) is a constant).
or
z''(t) = vSource/(C(t)*I(t)) - z'(t)/C(t)
You can implement this equation directly in Simulink using two integrators in series, one for z and the the other for z'. Set the initial condition on each as you desire. If you must use a time varying state space formulation, you can proceed as follows:
x = [z; z'].
A(t) =[0 1;0 -1/C(t)]
B(t) = [0; 1/(C(t)*I(t))]
C(t) = [1 0];
D(t) = 0;
Then set the initial conditions in your integrator block for x as [z(0) z'(0)]

#### 1 Comment

Rob Robinson on 14 Jul 2020
Hi Paul,
Thank you so much for all your help. I wasn't aware of the initial conditions in the integrator block and that has sorted my problem out.

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!