Function wbw: Finding the Bandwidth Frequency from the Damping Ratio and Peak or Settling Time
Below is the function wbw.m. This function will return the approximate bandwidth frequency of a system, given a corresponding damping ratio and rise or settling time. To employ the wbw.m function in MATLAB, enter wbw at the command line. You first will be prompted for a damping ratio. You will then be asked to enter "0" if you are using a settling time or "1" if you are using a peak time. Finally, you will be asked for the desired settling or peak time, and the bandwidth frequency will be returned. Copy the following text into a file wbw.m, and save it in the same directory as the MATLAB software, or in a directory which is contained in MATLAB's search path.
function[] = wbw()
DR = input('Damping Ratio? ');
n = 0;
n = input('Settling Time(0) or Peak Time(1)? ');
if n == 0
ts = input('Settling Time? ');
temp1 = sqrt((4*DR^4) - (4*DR^2) +2);
temp2 = 1- (2*DR^2);
temp3 = 4/(ts*DR);
Wbw = temp3*sqrt(temp1 + temp2)
end
if n ==1
ts = input('Peak Time? ');
temp1 = sqrt((4*DR^4) - (4*DR^2) +2);
temp2 = 1- (2*DR^2);
temp3 = ts*sqrt( 1- DR^2);
temp4 = pi/temp3;
Wbw = temp4*sqrt(temp1 + temp2)
end






