How can I deal with the content of a generalized matrix?
2 次查看(过去 30 天)
显示 更早的评论
I would like to operate with a generalized matrix / generalized system getting the real and imaginary parts of its elements, but the use of real tunable parameters is not compatible.
a = realp('a',1);
b = realp('b',-0.5);
D = a+1i*b;
sys = ss([],[],[],D)
real(sys.D)
I know I can get the value, but I looking for the expression with the tunable parameter. I also know that symbolic computing could be an option, but it is not compatible with state-space dynamic systems.
0 个评论
回答(1 个)
MULI
2024-6-18
Hi Mario,
I understand that you are facing an issue in handling complex numbers to separate the real and imaginary parts within a control system model.
Below MATLAB Code helps in modifying these values:
% Define the real and imaginary parts as tunable parameters
a = realp('a', 1); % Real part with initial value 1
b = realp('b', -0.5); % Imaginary part with initial value -0.5
% Combine 'a' and 'b' to form a complex number for the D matrix in a state-space model
D = a + 1i*b
% Create the state-space model with this D matrix
sys = ss([], [], [], D);
% Update the values of 'a' and 'b'
sys.Blocks.a.Value = 2; % New value for 'a'
sys.Blocks.b.Value = -1; % New value for 'b'
% Display the current D matrix of the system
disp('Updated D matrix:');
disp(sys.D);
By executing these statements, the values of the parameters `a` and `b` within your system model `sys` can be modified programmatically.
You may refer this documentation link for more information on properties of “ss” (state space model) function.
Hope this clears your query!
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!