Solving state space equation using matlab function block in simulink
Show older comments
Hi, Im trying to model a synchronous machine. My present situation is, i know the A, B, C, D values and my input signal is coming from other blocks which are voltages, speed etc. State variable in my case is flux. I need to find this flux value so as to find derive current, torque etc. So how to solve this state space equation to get the state variable. I tried to read many examples but im not able to find the one I need. Any help is appreciable
Answers (1)
Sebastian Castro
on 18 Aug 2015
0 votes
- Sebastian
5 Comments
leonn alexander
on 18 Aug 2015
Sebastian Castro
on 18 Aug 2015
That block takes in the A, B, C, D matrices as MATLAB matrices -- not much to it!
Also yes, if y = x, then your C and D matrices are 1 and 0 respectively, as you said. For example, if your A matrix is 4x4, your C matrix is the 4-dimension identity matrix: In MATLAB, eye(4).
Mahmoud Aly
on 18 Jul 2025
If the state space matrix are function of variable which is varying, what is the best way to solve the state?
Sam Chak
on 18 Jul 2025
Hi @Mahmoud Aly
For single-variable systems such as
, you can use the Fcn block to apply the nonlinear function
to its input (state variable x and input signal u). After that, connect the Fcn block to an Integrator block, which implies the output
. Before clicking the Run button, specify the initial value in the Integrator block.
. Before clicking the Run button, specify the initial value in the Integrator block.For multivariate systems,
, with the state vector
and input vector
, you can use n sets of Fcn and Integrator pairs, or one MATLAB Function block and an Integrator block.
and input vector
, you can use n sets of Fcn and Integrator pairs, or one MATLAB Function block and an Integrator block.
Paul
on 18 Jul 2025
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!