# Problem with using mussv

17 views (last 30 days)
Ofek Frank-Shapir on 25 Feb 2024
Commented: Paul on 25 Feb 2024
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)];
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?

Paul on 25 Feb 2024
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');
size(state_space)
State-space model with 87 outputs, 87 inputs, and 3 states.
freq_data = freqresp(state_space,w_vec);
size(freq_data)
ans = 1×3
87 87 100
The block structure is
Blocks = [N-1,3*(N-1);N-1,3*(N-1);N-1,3*(N-1)]
Blocks = 3×2
29 87 29 87 29 87
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)
ans = 1×3
87 261 100
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)))
Ofek Frank-Shapir on 25 Feb 2024
Thank you!
this indeed solved the problem.
Paul on 25 Feb 2024
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.
Also, freq_data_rearanged could be constructed with one call to append if freq_data is an frd object and mussv shold work fine if freq_data_rearranged is an frd object.

### Categories

Find more on Setup for Tuning MATLAB Models in Help Center and File Exchange

R2023b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!