I have made a function to optimise the overall gain, pole frequencies and zero frequencies for the oplev filter. The script will optimize any user defined number of poles and zeros in order to minimise the RMS motion below a certain cut off frequency (in this case 20Hz). The overall gain is adjusted so that each trial filter shape always has a UGF of 10 Hz.
I have a attached a plot showing the power spectrum and RMS curves for the optimization result for 2 zeros and 2 poles, optimized to give a minimal RMS below 20Hz.
I have also attached a plot showing the loop gain and the filter transfer function.
The noise spectrum shows that the optimised filter gives a better noise performance below 10Hz, but a servo oscillation at the UGF of 10 Hz means it injects a lot of motion around this frequency. Should I consider some more aggressive way to force the script to keep a decent phase margin?
The fminsearch results show that the 'optimized' solution is two resonant peaks:
 Optimisation completed after 571 iterations
Started with:
Pole 1 frequency = 1 Hz
Pole 2 frequency = 2 Hz
Zero 1 frequency = 0.1 Hz
Zero 2 frequency = 5 Hz
Overall gain = 1
Finished with:
Pole 1 frequency = 0.0497181 Hz
Pole 2 frequency = 2.01809 Hz
Zero 1 frequency = 0.0497181 Hz
Zero 2 frequency = 2.01809 Hz
Overall gain = 71970.1
Initial RMS below 10 Hz = 5.90134e06
Remaining RMS below 10 Hz = 8.42898e07
