Thomas0320
Newbie
There's a RLC circuit in series.
I have used current and derivative of current as state variables, and I've written the MATLAB code of the discrete state space equations.
The problem I encountered is that the when I plot the derivative of current (the second state variable) on Matlab, it's equal to the current graph obtained from LTSpice.
Also when I plot the current on Matlab, it's same shape as the voltage but smaller by scale of 0.5 which is capacitance.
Can someone suggest me what could be the reason for this?
The attached images are my matlab code and the simulation I had
I have used current and derivative of current as state variables, and I've written the MATLAB code of the discrete state space equations.
The problem I encountered is that the when I plot the derivative of current (the second state variable) on Matlab, it's equal to the current graph obtained from LTSpice.
Also when I plot the current on Matlab, it's same shape as the voltage but smaller by scale of 0.5 which is capacitance.
Can someone suggest me what could be the reason for this?
--- Updated ---
The attached images are my matlab code and the simulation I had
Last edited: