Problem with using mussv
11 次查看(过去 30 天)
显示 更早的评论
I have a state space representation of a system and I am interested in its frequency response. I calculate it using the function freqresp and the resulting array has dimensions: 3*(N-1)x3*(N-1)x100 (because the length of my frequency vector is 100). This works as expected, and the next thing I do is to rearrange the array that I got (by adding zeros) using the cat command to have dimensions: 3*(N-1)x9*(N-1)x100. This also works as expected. The reason for doing that is because I want to calculate bounds on the structured singular values of this rearranged array, and my uncertainty set is comprised of 3 blocks of dimensions: (N-1)x3*(N-1).
For clarification I provide a relevant part of my code:
N = 30;
R = 690;
w_vec = logspace(-5,5,100);
Blocks = [N-1,3*(N-1);N-1,3*(N-1);N-1,3*(N-1)];
state_space = ss(A,B,C_grad,D);
freq_data = freqresp(state_space,w_vec);
O = zeros(N-1,3*(N-1),length(w_vec));
freq_data_rearanged = cat(1,cat(2,freq_data(1:N-1,:,:),O,O), ...
cat(2,O,freq_data(N:2*(N-1),:,:),O), ...
cat(2,O,O,freq_data(2*N-1:3*(N-1),:,:)));
bounds = mussv(freq_data_rearanged,Blocks,'Ufs');
My problem is that I get the error: The dimensions of matrix are incompatible with the BLK dimensions.
I don't understand why this is happening, because as far as I understand my uncertainty matrix has dimensions: 3*(N-1)x9*(N-1) and the frequency response (named freq_data_rearanged in the code) has dimensions 3*(N-1)x9*(N-1)x100.
What am I doing wrong here?
0 个评论
采纳的回答
Paul
2024-2-25
Hi Ofek,
N = 30;
w_vec = logspace(-5,5,100);
"I calculate it using the function freqresp and the resulting array has dimensions: 3*(N-1)x3*(N-1)x100 (because the length of my frequency vector is 100)."
Based on that statement, the system state_space will have 3*(N-1) inputs and 3*(N-1) outputs. Since that system is not given, I'll create one with just a few states and compute its frequency response
rng('default');
state_space = rss(3,3*(N-1),3*(N-1));
size(state_space)
freq_data = freqresp(state_space,w_vec);
size(freq_data)
The block structure is
Blocks = [N-1,3*(N-1);N-1,3*(N-1);N-1,3*(N-1)]
which means the system has three full blocks of complex uncertainty, each with dimension of 29 x 87.
Create the augmented system
O = zeros(N-1,3*(N-1),length(w_vec));
freq_data_rearanged = cat(1,cat(2,freq_data(1:N-1,:,:),O,O), ...
cat(2,O,freq_data(N:2*(N-1),:,:),O), ...
cat(2,O,O,freq_data(2*N-1:3*(N-1),:,:)));
size(freq_data_rearanged)
Each page of freq_data_rearanged, calli it M, is 87 x 261, i.e., it represents a system with 87 outputs and 261 inputs. But the uncertainty is a block diagonal matrix, call it D, with dimensions that are also 87 x 261. But M and D have to be compatible for multiplication (I - M*D is the quantity of interest), which they are not. Either D should be 261 x 87 and M 87 x 261, or vice versa.
Here's the result assuming the uncertainty blocks need to be transposed
bounds1 = mussv(freq_data_rearanged,fliplr(Blocks),'Ufs');
figure
semilogx(w_vec,db(squeeze(bounds1)))
And here is the result assuming the system needs to be transposed
bounds2 = mussv(pagetranspose(freq_data_rearanged),Blocks,'Ufs');
figure
semilogx(w_vec,db(squeeze(bounds2)))
2 个评论
Paul
2024-2-25
You're quite welcome.
If you don't mind me asking, I'm curious about this procedure. Why is the original system 87 x 87 which then needs to be block diagonalized into 87 x 261? That seems atypical for an uncertain, physical system.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!