Code covered by the BSD License  

Highlights from
Reliable and Roubst Design

image thumbnail
from Reliable and Roubst Design by Stuart Kozola
MATLAB Code used in the Jan 2008 Digest Article

myNonlCon(x,simParms)
function [c,ceq] = myNonlCon(x,simParms)
%% mynonlcon.m  Nonlinear constraints for fmincon.

% Extract suspension variables
kf = x(1);
cf = x(2);
kr = x(3);
cr = x(4);

% Extract parameters needed for constraints
struct2var(simParms)

%% Define Desired Damping Coefficient
%cd = 0.40;
% Can tolerate a +/-10% change from desired damping coefficient
cupper = 0.5;     % upper limit for damping coefficients
clower = 0.3;     % lower limit for damping coefficients

%% Compute Constraints
Mf = Mb*Lr/(Lf+Lr)/2;
Mr = Mb*Lf/(Lf+Lr)/2;

 % Inequality constraints c <= 0
c = [sqrt(kf/Mf)/(2*pi)-2;...       % fn <= 2 Hz for front
     sqrt(kr/Mr)/(2*pi)-2;...       % fn <= 2 Hz for rear
     cf/(2*sqrt(kf*Mf))-cupper;...  % damping ratio for front
     clower-cf/(2*sqrt(kf*Mf));...
     cr/(2*sqrt(kr*Mf))-cupper;...  % damping ratio for rear
     clower-cr/(2*sqrt(kr*Mf))];
 
ceq = [];

Contact us at files@mathworks.com