# Electrical Engineering - State Space - Matlab

1. Jan 26, 2014

### GreenPrint

1. The problem statement, all variables and given/known data

$\dot{}$

I'm given the following circuit

http://imagizer.imageshack.us/v2/800x600q90/43/bwka.png [Broken]

2. Relevant equations

3. The attempt at a solution

I come up with the transfer function to be $G(s) = \frac{s}{2+\frac{1}{s}}$. The question asks me to

Plot step response using MATLAB step command and frequency response using bode command. Can you interpret the frequency response in terms of low pass, band pass or high pass filters for the two circuits?

It's been a while since I have messed around with MATLAB and I seem to be struggling with finding the state space representation of this circuit. I solved a similar problem with a voltage source, two resistors, one capacitor, and one inductor using state representation without issue. The problem is that I'm not exactly sure how to apply this technique to this circuit because there is only one capacitor. I know that for state space representation with two variables

$\stackrel{.}{x} = Ax + Bu$
$y = Cx + Bv$

For the circuit I set the current through the inductor $i_{L}$ to be $x_{1}$. Because $V_{L} = L \frac{d I_{L}}{dt} = L \stackrel{.}{x_{1}}$. Since $L = 1 H$ I can state that $V_{L} = \dot{x_1}$, which is also equal to $v_{O}(t)$.

I use nodal analysis and assume that the current through the inductor is going towards ground (which I took to be the bottom of the circuit near the negative lead of the voltage source), the current through the capacitor with the output voltage $v_{o}(t)$ across to be going from the top node to ground, and finally the current from the voltage source across the $1 Ω$ resistor to be going into the node. This resulted in the following equation.

$\frac{v_{i}(t) - \dot{x_{1}}}{1 Ω} = x_{1} + \dot{x_{1}}$

Solving for $\dot{x_{1}}$ I get

$2\dot{x_{1}} = v_{i}(t) + x_{1}$
$\dot{x_{1}} = \frac{1}{2}x_{1} + \frac{1}{2}v_{i}(t)$

I seem to be having some trouble because I'm unsure how to solve for the output equation $v_{o}(t)$ in terms of the current through the inductor $x_{1}$. I know that $v_{o}(t) = \dot{x_{1}}$ but that doesn't really help me because I need to get the equation in terms of $x_{1}$ and not $\dot{x_{1}}$

When I solved the similar problem I got an answer of the form

$[\stackrel{\dot{x_{1}}}{\dot{x_{2}}}] = [\stackrel{-\frac{1}{2}}{1} \stackrel{-1}{0}][\stackrel{x_{1}}{x_{2}}] + [\stackrel{\frac{1}{2}}{0}]v_{i}(t)$
$v_{o}(t) = [0 1][\stackrel{x_{1}}{x_{2}}]$

Using MATLAB I then did the following to get the step response:

A=[-1/2 0;0 0];
B=[1/2;0];
C=[0 0];
D=0;
step(tf(ss(A,B,C,D)))

I'm not sure how I can apply what I learned from a similar problem to this problem because this problem only has one inductor and I'm not sure if these MATLAB functions will still work with only one variable.

Thanks for any help.

Last edited by a moderator: May 6, 2017
2. Jan 27, 2014

### donpacino

The problem is you're trying to relate current to voltage, which can get difficult. It would be easier to set the voltage as your state variable.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted