Calculation of P(s) transfer function or anything using H infinity conditions ?

19 vues (au cours des 30 derniers jours)
AMAN
AMAN le 17 Oct 2024
Modifié(e) : AMAN le 18 Oct 2024
This is the question ,I have calculated minimal and balanced realizations of the following question and have wriiten a code for the balanced and minimal realization but don't have any idea about the c part . For your convinence i have researced and came to conclusion that it is realted to hankel singular values of controllability and observability gramins. Please anyone complete the code and also direct me to necessary material. If image not proper i have attached the pdf link. Cheers!!!!
%Code for calculating the Balanced Realization
clear;
%This is the minimal realization of above transfer function
A=[-1 0 0 0 0 0;
0 -1 0 0 0 0;
0 0 -2 0 0 0;
0 0 0 -2 0 0;
0 0 0 0 -3 0;
0 0 0 0 0 -3];
B=[-1 0;
0 -2;
2 1;
-4 3;
0 -1;
4 0];
C=[1 0 1 0 1 0;
0 1 0 1 0 1];
D=[0 0; 0 0];
W_c=lyap(A,B*B')
W_o=lyap(A,C'*C)
Ro_upper=chol(W_o,"upper")
%R_o*W_c*R_o'
[U,S,V]=svd(Ro_upper*W_c*Ro_upper') %Here S is sigma^2
%Need to calculate Sigma^0.5
S=S^0.25
%Calculation of T Matrix
T=inv(Ro_upper)*U*S
% Calculation of balanced Realization
A_bal=inv(T)*A*T
B_bal=inv(T)*B
C_bal=C*T
D_bal=zeros(2,2)
%Checking if controllability gramin, observability gramin are equal or not
W_nc=inv(T)*W_c*(inv(T)')
W_no=T'*W_o*T
%Both are equal which means calculation of T is correct and we have the
%correct balanced realization
  2 commentaires
Pavl M.
Pavl M. le 17 Oct 2024
Modifié(e) : Pavl M. le 17 Oct 2024
Dear Friend,
A person, who fills appreciated will always do more than expected.
In order to correctly, precisely to solve a little bit of your effort is required.
As for to polish the question:
Here is your Post Description I have corrected:
This is the question is: I have calculated minimal and balanced realizations of the following question and have written a code for the balanced and minimal realization but don't have any idea about the c part . For your convinence I have researced and came to conclusion that it is realted to Hankel singular values of controllability and observability Gramians. Please anyone complete the code and also direct me to necessary material.
Interesting ... I once made many various norms in Python and TCE Matlab realization. Need to get helped by substance to retrieve from storage.
Please edit your embedded picture dimensions: just shrink it because not seen rightmost part of the matrix on picture.
What is the sampling frequency?
It is Very Interesting Control Systems Engineering assingment. Specifically I detected the question is dedicated to numerical analysis of differential equations based system parameters for probable control design.
Who are You?
What have you found on Hankel and Gramian?
What is the motivation to transform controlability and observability system's matrices by the so decomposition?
What is the SS / system equations?
Is it y = P*x + u or x_next = P*x_prev, y = C*x +D*u?
Can we continue to work on the valued IT, ICT domain, Electric Power Steering,Steer-by-wire,Hydraulic-Power-Steering(HPS), motor-driven power steering and IT(for example to join our heads and hands together, to merge effort, to help to each other substantially, not to ignore financial aid/help requests and hiring/employing looking for a job request (what really does it take to fill commercial fin. form, online fields order to pay to us to support better thinking financial worries free, best thinking requires it) within the well defined limited circle to regulate Vehicular Systems (they think servomotor driven power steering will dominate, while HPS is more efficient, right?, >>>>> towards better future) Vickrey–Clarke–Groves auction, ML, Steer-by-wire, Data Science, Optimizations Engineering Design, Revamping and application, Machine Learning, codeworks primary duty projects projects+?
Work here takes significant time.
So far you have applied Cholesky and Singular Value Decomposition of matrices.
I'd complete the analysis and corresponding decomposition if as necessary and legitimately to hire me in private contact, let them not delay my hiring, employment.
AMAN
AMAN le 18 Oct 2024
I solved it now i will share the code for your convinence
%Code for calculating the Balanced Realization
clear;
A=[-1 0 0 0 0 0;
0 -1 0 0 0 0;
0 0 -2 0 0 0;
0 0 0 -2 0 0;
0 0 0 0 -3 0;
0 0 0 0 0 -3]
B=[-1 0;
0 -2;
2 1;
-4 3;
0 -1;
4 0]
C=[1 0 1 0 1 0;
0 1 0 1 0 1]
D=[0 0; 0 0]
W_c=lyap(A,B*B')
W_o=lyap(A,C'*C)
Rc_lower=chol(W_c,"lower")
Rc_upper=chol(W_c,"upper")
Ro_lower=chol(W_o,"lower")
Ro_upper=chol(W_o,"upper")
%R_o*W_c*R_o'
[U,S,V]=eig(Ro_upper*W_c*Ro_upper') %Here S is sigma^2
%Need to calculate Sigma^0.5
S=S^0.25
%Calculation of T Matrix
T=inv(Ro_upper)*U*S
% Calculation of balanced Realization
A_bal=inv(T)*A*T
B_bal=inv(T)*B
C_bal=C*T
D_bal=zeros(2,2)
system=ss(A_bal,B_bal,C_bal,D_bal)
SYSTEM_TF=tf(system)
%Checking if controllability gramin, observability gramin are equal or not
W_nc=inv(T)*W_c*(inv(T)')
W_no=T'*W_o*T
%Both are equal which means calculation of T is correct and we have the
%correct balanced realization
% FOR WRITING THE P(s) in LATEX FORMAT
%Display the transfer function
disp('The transfer function SYSTEM_TF is:');
disp(SYSTEM_TF);
% Convert transfer function to LaTeX format
[num, den] = tfdata(SYSTEM_TF); % Extract numerator and denominator
% Generate LaTeX code for each element in the transfer function matrix
for i = 1:size(num, 1)
for j = 1:size(num, 2)
numerator = num{i, j};
denominator = den{i, j};
% Create LaTeX representation
num_str = poly2str(numerator, 's');
den_str = poly2str(denominator, 's');
% Construct the LaTeX string
latex_str = sprintf('H_{%d%d}(s) = \\frac{%s}{%s}', i, j, num_str, den_str);
% Display the LaTeX string
disp('LaTeX code for the transfer function:');
disp(latex_str);
end
end
%% Part 3
Sigma=S^2 %Sigma =s^2 so we can get Sigma because S=s^0.5 before it
tr=2*trace(Sigma)
A11 = A_bal(1:3, 1:3)
B1 = B_bal(1:3,1:2)
C1 = C_bal(1:2,1:3)
D = zeros(2,2)
sys_new=ss(A11,B1,C1,D)
sys_new_tf=tf(sys_new)
[num, den] = tfdata(sys_new_tf); % Extract numerator and denominator
% Generate LaTeX code for each element in the transfer function matrix
for i = 1:size(num, 1)
for j = 1:size(num, 2)
numerator = num{i, j};
denominator = den{i, j};
% Create LaTeX representation
num_str = poly2str(numerator, 's');
den_str = poly2str(denominator, 's');
% Construct the LaTeX string
latex_str = sprintf('H_{%d%d}(s) = \\dfrac{%s}{%s}', i, j, num_str, den_str);
% Display the LaTeX string
disp('LaTeX code for the transfer function:');
disp(latex_str);
end
end

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Stability Analysis 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!

Translated by