# How to create a weighting function (bandpass filter) for state space to use for hinfstruct

9 views (last 30 days)
Maximilian Schatz on 23 Mar 2020 at 20:36
Edited: Maximilian Schatz on 27 Mar 2020 at 7:33
According to the MATLAB example "Control of Aircraft Lateral Axis Using mu-Synthesis" I want to create a weighting function, bandpass filter, to extract only certain frequency interval of my mechanical plant in state space representation , that I want to use for the hinfstruct(). Only the range from 40 to 60 Hz is point of interest for the optimization.
I chose a butterworth filter with for an interval from 40 to 60 Hz and of high order for a "clear cut". Next it is tranformed to a tranfer function with specifed I/O. The bodeplot shows me the real properties of the filter (normalized), where contrary to this fvtool shows the properties I want to achieve.
[b, a] = butter(10,[40 60]/200);
W_but = tf(b,a); W_but.u='p'; W_but.y='fp';
figure
bodemag(W_but)
figure
fvtool(b,a,'Fs',200) % desired representation
The problem is now, that the resulting filter is normalized and the gain is altered. What should I do, to get the once again in the desired frequency resolution to connect the filter with the plant (genss), to which I added some tuneable parameters. This will be then the input for hinfstruct(). The bodemag of non-normalized W_but should look like the one from fvtool().
For testing reason one can use the plant of the plant from the example mentioned at the beginning, to solve my main problem, that I don't filter the desired frequency range. For example, when I now want to filter around 100 Hz instead of 1 Hz, like it does now.
LateralAxis.u = {'u1','u2'};
LateralAxis.y = {'p','y1','y2','y3'};
Sys_test = connect(LateralAxis,W_but,{'u1','u2'},{'fp','y1','y2','y3'});
bodemag(Sys_test(1,1),LateralAxis(1,1))
PS: I thought about connecting the plant and the weighting function before introducing the tuneable parameter. Therefore I had to transforme the plant from ss to frd, then normalize it and multiply with the weighting function. Afterwards a transformation back to ss could be performed. But this process is quite laborious in my opinion and I guess there is a better way to do so, but I can't get it.

Maximilian Schatz on 27 Mar 2020 at 7:29
Edited: Maximilian Schatz on 27 Mar 2020 at 7:33
Well, I found an answer to my problem and maybe someone will struggle in the same way:
By having a look in the scource code of butter.m with the command:
edit butter
I found out, that it's possible to give the function an additional input argument, which is not very clear described in the documentation.
[b, a] = butter(10,2*pi*[40 60],'s');
The 's' argument, specifies the filter as analog and therefore it is not normalized.