//
matlab 连续系统状态空间表达式的离散化&状态转移矩阵求解_matlab状态方程离散化-CSDN博客
//
%https://blog.csdn.net/weixin_44051006/article/details/107007916
clear all; clc;
syms R1 R2 C1 C2 Ts Qn s t Ls A BA=[-1/(R1*C1) 0 0;0 -1/(R2*C2) 0;0 0 0];%系统矩阵B=[1/C1;1/C2;-1/Qn];I = eye(size(A));
Ls = inv(s*I - A); % INV(X) is the inverse of the square matrix X.
G = ilaplace(Ls,s,t) % Inverse Laplace transformHLs = int(G,t,0,Ts);
H = HLs*B%% %%%%%%
R1_value=0.0019;
R2_value=0.0035;
C1_value=23340;
C2_value=501270;
R0_value = 0.0037;
Qn_value = 30.23*3600;
Ts_value = 0.1;
t_value = 0.1;G_value_sym = subs(G,[R1 R2 C1 C2 t Qn],[R1_value R2_value C1_value C2_value Ts_value Qn_value]);
H_value_sym = subs(H,[R1 R2 C1 C2 Ts Qn],[R1_value R2_value C1_value C2_value Ts_value Qn_value]);G_value = double(G_value_sym)
H_value = double(H_value_sym)%% %%%%%%
A_value_sym=subs(A,[R1 R2 C1 C2 Qn],[R1_value R2_value C1_value C2_value Qn_value]);
B_value_sym=subs(B,[R1 R2 C1 C2 Qn],[R1_value R2_value C1_value C2_value Qn_value]);
A_value = double(A_value_sym);
B_value = double(B_value_sym);[G2,H2] = c2d(A_value,B_value,Ts_value)
//
G =[exp(-t/(C1*R1)), 0, 0]
[ 0, exp(-t/(C2*R2)), 0]
[ 0, 0, 1]H =-R1*(exp(-Ts/(C1*R1)) - 1)
-R2*(exp(-Ts/(C2*R2)) - 1)-Ts/QnG_value =0.9977 0 00 0.9999 00 0 1.0000H_value =1.0e-05 *0.42800.0199-0.0919G2 =0.9977 0 00 0.9999 00 0 1.0000H2 =1.0e-05 *0.42800.0199-0.0919>>