how to add a state space representation with identifiable parameters into a Matlab function or a any block?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everyone,
I found a way to add the disturbances into the state space representation but I don't know how create a block for that,
so I have created a matlab function with the code,
function [SOC,LOH] = statespace(PH2,Pgrid,d)
A = [1 1;1 1];
B = [0.0936 0.0936;-0.339 0];
C = [1 1;1 1];
D = 0;
K = [0.0936;0];
[SOC,LOH] = idss(A,B,C,D,K);
end
so the figure 1 is what i tried to do with the code above, and figure 2 is the state space representation with disturbances,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352619/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352624/image.png)
and the error is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352629/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352634/image.png)
1 commentaire
Walter Roberson
le 11 Avr 2023
I wonder if it would help to use https://www.mathworks.com/help/control/ref/tunabless.tunabless.html ?
Réponses (1)
Sam Chak
le 12 Avr 2023
Hi @kawsar
I'm unfamiliar with your system (probably something to do with the state of charge of an energy storage system).
However, the Output Matrix
, because it implies both outputs are the same
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352859/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352864/image.png)
Please check the matrix equations again.
A = [1 1; % state matrix
1 1];
B = [0.0936 0.0936; % input matrix
-0.339 0];
C = [1 1]; % output matrix
D = zeros(1, 2); % direct matrix
K = [0.0936; 0]; % disturbance matrix
sys = idss(A, B, C, D, K)
x0 = [0.1, 0.1];
Ts = 0.1;
% sys = idss(A, B, C, D, K, x0, Ts)
0 commentaires
Voir également
Catégories
En savoir plus sur Event Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!