Discrete state space equation of rlc - getting a wrong graph

Status
Not open for further replies.

Thomas0320

Newbie
Joined
Mar 27, 2023
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
9
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?
--- Updated ---


The attached images are my matlab code and the simulation I had
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…