# Space State Model for an electronic circuit

#### Current_Source

Joined Dec 10, 2015
16
Hello!

I am trying to find a space state model for the following circuit. My approach was to try to divide the circuit in various blocks and then
find the output expression for those blocks.

So i have defined the voltages V1,V2 and Vo has shown in the circuit.

Then i have calculated the ouput expressions for the blocks i have considered and i got:

Note that for representing V1(dotted)i used small case letters that is in this case, v1

$$Equation 1 [plain][tex] (Vi-0)=C1*(d)/(dt)*(0-V1)+(0-V1)/(R2) (Vi)/(R1)=-C1*v1-(V1)/(R2) -C1*v1=-(V1)/(R2)-(Vi)/(R1) v1=(V1)/(C2*R2)+(Vi)/(C2*R1)$$

$$Equation 2: (Vi-0)/(R4)+(V1-0)/(R3)=C2*(d)/(dt)*(0-V2)+(0-V2)/(R5) (Vi)/(R4)+(V1)/(R3)=-C2*v2-(V2)/(R5) -C1*v2=-(V2)/(R5)-(Vi)/(R4)-(v1)/(R3) v2=(V2)/(C2*R5)+(Vi)/(C2*R4)+(V1)/(C2R3)$$

$$Equation 3: (V2-0)/(R7)+(V1-0)/(R4)=(0-Vo)/(R6) (V2)/(R7)+(V1)/(R4)=-(Vo)/(R6) (Vo)/(R6)=(-V2)/(R7)-(V1)/(R4)$$

So the matrix that represent the space state model of the circuit are

$$[v1;v2]=[(1)/(C2*R2) 0 ; (1)/(C2*R3) (1)/(C2*R5)] [V1;V2] +[(1)/(C2*R1); (1)/(C2*R4)] *Vi Vo=[-1 -1] [V1;V2] + 0*Vi$$

Is this correct? Thanks

#### Attachments

• 230 KB Views: 12

#### sailorjoe

Joined Jun 4, 2013
363
http://faculty.uml.edu/thu/controlsys/note03.pdf
The first few slides describe the methodology. Did you follow these steps.
On first look, your equations seem reasonable, but the text is hard to interpret to ensure accuracy of reading.

#### MrAl

Joined Jun 17, 2014
8,259
Hello!

I am trying to find a space state model for the following circuit. My approach was to try to divide the circuit in various blocks and then
find the output expression for those blocks.

So i have defined the voltages V1,V2 and Vo has shown in the circuit.

Then i have calculated the ouput expressions for the blocks i have considered and i got:

Note that for representing V1(dotted)i used small case letters that is in this case, v1

$$Equation 1 [plain][tex] (Vi-0)=C1*(d)/(dt)*(0-V1)+(0-V1)/(R2) (Vi)/(R1)=-C1*v1-(V1)/(R2) -C1*v1=-(V1)/(R2)-(Vi)/(R1) v1=(V1)/(C2*R2)+(Vi)/(C2*R1)$$

$$Equation 2: (Vi-0)/(R4)+(V1-0)/(R3)=C2*(d)/(dt)*(0-V2)+(0-V2)/(R5) (Vi)/(R4)+(V1)/(R3)=-C2*v2-(V2)/(R5) -C1*v2=-(V2)/(R5)-(Vi)/(R4)-(v1)/(R3) v2=(V2)/(C2*R5)+(Vi)/(C2*R4)+(V1)/(C2R3)$$

$$Equation 3: (V2-0)/(R7)+(V1-0)/(R4)=(0-Vo)/(R6) (V2)/(R7)+(V1)/(R4)=-(Vo)/(R6) (Vo)/(R6)=(-V2)/(R7)-(V1)/(R4)$$

So the matrix that represent the space state model of the circuit are

$$[v1;v2]=[(1)/(C2*R2) 0 ; (1)/(C2*R3) (1)/(C2*R5)] [V1;V2] +[(1)/(C2*R1); (1)/(C2*R4)] *Vi Vo=[-1 -1] [V1;V2] + 0*Vi$$

Is this correct? Thanks

Hi,

You seem to be going in the right direction, however something looks wrong here in the analysis.
In particular, note in your section "Equation 1" the second and third actual equations.

The second appears to have the correct signs, but then the third seems to magically acquired a different sign in one of the terms. The question is, how did this happen.

If we look at the first op amp and remove the capacitor, we have input current:
Vin/R1

and feedback current:
V1/R2

however in order to equate these we have to note the inverting gain so instead of:
Vin/R1=V1/R2

which would mean if Vin was positive V1 would have to be positive too (not correct),
we would need to write:
Vin/R1=-V1/R2

and this explains how V1 can go negative when Vin is positive.
For example, if R1 was 1k and R2 was also 1k then the gain is -1, so we would have:
Vin=-V1

or:
V1=-Vin

and that is correct.

You can always suspect something is wrong in a state space equation if all the signs are the same because that usually indicates an unstable system because there is only positive feedback.
So go over your equations and see if you can correct the signs, then proceed to the final result and see what you get. We can then compare to another analysis and see if they match.

#### Current_Source

Joined Dec 10, 2015
16
Hi!

I have gone over the your equations and tried to correct the signs and i got:

Equation 1:

(Vi-0)=C1*(d)/(dt)*(0-V1)+(0-V1)/(R2)

(Vi)/(R1)=-C1*v1-(V1)/(R2)

-C1*v1=-(V1)/(R2)-(Vi)/(R1)

v1=-(V1)/(-C1*R2)-(Vi)/(-C1*R1)

Equation 2:

(Vi-0)/(R4)+(V1-0)/(R3)=C2*(d)/(dt)*(0-V2)+(0-V2)/(R5)

(Vi)/(R4)+(V1)/(R3)=-C2*v2-(V2)/(R5)

-C2*v2=-(V2)/(R5)-(Vi)/(R4)-(v1)/(R3)

v2=-(V2)/(-C2*R5)-(Vi)/(-C2*R4)-(V1)/(-C2*R3)

Equation 3:

(V2-0)/(R7)+(V1-0)/(R4)=(0-Vo)/(R6)

(V2)/(R7)+(V1)/(R4)=-(Vo)/(R6)

(Vo)/(R6)=(-V2)/(R7)-(V1)/(R4)

So the matrix that represent the space state model of the circuit are:

[v1;v2]=[-(1)/(-C1*R2) 0 ; -(1)/(-C2*R3) -(1)/(-C2*R5)] [V1;V2] +[-(1)/(-C1*R1); -(1)/(-C2*R4)] *Vi

Vo=[-1 -1] [V1;V2] + 0*Vi

Is it correct now?

Thanks

#### MrAl

Joined Jun 17, 2014
8,259
Hello again,

Sorry to say that you must be applying general circuit analysis incorrectly or something because again you ended up with the signs all the same, once you reduce the signs that is. I also cant understand why you would want to put minus signs in the denominators, while the numerator also has a minus sign. That makes that term positive again

The general form you will see mostly will look like this:
dY=E-F

where E contains the excitation and F contains the feedback. The minus sign ithere shows that the feedback is negative. If that was not a minus sign but instead a plus sign, then the feedback would be positive. It is possible to have positive feedback, but not usually when it is the only feedback. Usually if there is positive feedback then there is another term that represents negative feedback and that is what keeps the system stable.

So if you see:
dY=E+F

that's probably not right, because you know that dY there is a time derivative, and if everything on the right side was positive that would mean that the derivative would increase indefinitely over time, which would lead to an infinite response. Therefore at least one negative term is usually required on the right.

Also not right would be the form:
-dY=-E-F

because that simplifies again to all positive signs dY=E+F.

Also not right would be:
dY=-E/(-1)-F/(-1)

because again that simplifies to dY=E+F.

Also not usually correct would be:
dY=-E-F

because now the derivative decreases indefinitely heading toward minus infinity.
So for the derivative to reach zero for some time (a requirement) it is required to have at least one term positive and one term negative. However, you should not simply force one to be negative and one to be positive if there are two terms, but instead should go over your method of circuit analysis to find out what went wrong. It's the signs of course, so you'll have to figure out why.
One hint would be that for a positive input current through R1, to satisfy the op amp requirement to have zero input current at the inverting terminal we need the current through R2 to flow OUT of the inverting terminal node (after removing the capacitor from the circuit for simplicity). That means the current through R2 flows from the node at the inverting terminal to the output, not from the output to the input node.

See if that helps.

Last edited:

#### Current_Source

Joined Dec 10, 2015
16
Hello again,

Sorry to say that you must be applying general circuit analysis incorrectly or something because again you ended up with the signs all the same, once you reduce the signs that is. I also cant understand why you would want to put minus signs in the denominators, while the numerator also has a minus sign. That makes that term positive again

The general form you will see mostly will look like this:
dY=E-F

where E contains the excitation and F contains the feedback. The minus sign ithere shows that the feedback is negative. If that was not a minus sign but instead a plus sign, then the feedback would be positive. It is possible to have positive feedback, but not usually when it is the only feedback. Usually if there is positive feedback then there is another term that represents negative feedback and that is what keeps the system stable.

So if you see:
dY=E+F

that's probably not right, because you know that dY there is a time derivative, and if everything on the right side was positive that would mean that the derivative would increase indefinitely over time, which would lead to an infinite response. Therefore at least one negative term is usually required on the right.

Also not right would be the form:
-dY=-E-F

because that simplifies again to all positive signs dY=E+F.

Also not right would be:
dY=-E/(-1)-F/(-1)

because again that simplifies to dY=E+F.

Also not usually correct would be:
dY=-E-F

because now the derivative decreases indefinitely heading toward minus infinity.
So for the derivative to reach zero for some time (a requirement) it is required to have at least one term positive and one term negative. However, you should not simply force one to be negative and one to be positive if there are two terms, but instead should go over your method of circuit analysis to find out what went wrong. It's the signs of course, so you'll have to figure out why.
One hint would be that for a positive input current through R1, to satisfy the op amp requirement to have zero input current at the inverting terminal we need the current through R2 to flow OUT of the inverting terminal node (after removing the capacitor from the circuit for simplicity). That means the current through R2 flows from the node at the inverting terminal to the output, not from the output to the input node.

See if that helps.
Hi !

First thanks for replying and for the patience that you had trying to explain me what i was doing wrong.

I understood your explication concerning the negative feedback associated to all operational amplifiers that are present in the circuit and
how my solution has to be wrong considering that.

Considering what you have said : "R2 flows from the node at the inverting terminal to the output, not from the output to the input node."
i have tried to write the equations again considering that the currents in the circuit flows from the inverting terminal to the output in all nodes of the circuit

Equation 1:

(Vi-0)/(R1)=C1*(d)/(dt)*(V1-0)+(V1-0)/(R2)

(Vi)/(R1)=C1*V1+(V1)/(R2)

C1*v1=(V1)/(R2)-(Vi)/(R1)

v1=(V1)/(C1*R1)-(Vi)/(C1*R1)

Equation 2:

(Vi-0)/(R4)+(V1-0)/(R3)=C2*(d)/(dt)*(V2-0)+(V2-0)/(R5)

(Vi)/(R4)+(V1)/(R3)=C2*v2-(V2)/(R5)

C2*v2=(Vi)/(R4)+(V1)/(R3)+(V2)/(R5)

v2=(Vi)/(R4*C2)+(V1)/(R3*C2)+(V2)/(R5*C2)

Equation 3:

(V2-0)/(R7)+(V1-0)/(R4)=(Vo-0)/(R6)

(V2)/(R7)+(V1)/(R4)=(Vo)/(R6)

(Vo)/(R6)=(V2)/(R7)+(V1)/(R4)

Now considering that i want to represent the system using the form: x=Ax+Bu
y=Cx+D

I got the following matrix[A,B,C and D] (represented using Matlab notation):

A=[(1)/(C1*R1) 0 ; (1)/(C2*R3) (1)/(C2*R5)] x=[V1;V2] B=[-(1)/(C1*R1); (1)/(C2*R4)] u=(Vi)

C=[1 1] [V1;V2] D=0

Is it correct now?

Thanks for all the help

#### MrAl

Joined Jun 17, 2014
8,259
Hello again,

You may or may not have it right this time, but we need to look at your second and third equations in your section labeled "Equation 1".

What does not make sense is how you got from:
[1] (Vi)/(R1)=C1*V1+(V1)/(R2)

to:
[2] C1*v1=(V1)/(R2)-(Vi)/(R1)

because if we subtract V1/R2 from both sides of the first equation above we get:
C1*v1=Vi/R2-V1/R1

and not:
C1*v1=V1/R1-Vi/R2

Take a look at the attachment and see if that helps.

First, the passive sign convention defines the polarity of a voltage
across a circuit element when the current flow is known. If the current
enters the left hand side of the element then the left hand side voltage
is positive. There are two main ways to show this, one is with the plus
and minus signs as shown, and the other is with the arrow where the
head of the arrow (pointy end) is positive.

Now we turn to the op amp circuit.
Drawn is a basic op amp circuit showing the virtual ground and that means
that the inverting terminal is treated as being at zero volts (0v) at
all times. Since the input voltage appears across R1 it is shown as Vi,
and since I1 enters the left hand side of R1 the left hand side of R1 is
positive. Since I2 enters the left hand side of R2 the left hand side of
R2 is positive, and the voltage is Vfb.
Note however that the head of Vout does not appear at the same node as the
head of Vfb, so that means Vfb=-Vout or Vout=-Vfb. Vfb is negative which
is also apparent from the voltage arrow, which has head at 0v and tail at
Vout.

Now since there is no input current to the inverting terminal that means
I2=I1 and so we equate those two. Since I1=Vi/R1 and I2=Vfb/R2 and
I1=I2 we have:
Vi/R1=Vfb/R2
and since Vfb=-Vout we can replace Vfb with -Vout and we get:
Vi/R1=-Vout/R2

So you see how the minus sign comes in here due to the way the currents flow
and the resulting polarities.

#### Attachments

• 21 KB Views: 4