I have just studied Matlab so i am so sorry if this problem is 'stupid'. I am stuck on dealing error 'Error Not enough input arguments' when i use nonlcon for Fmincon command. Here is my code:
%THE ROBUST RELIABILITY DESIGN METHOD
% Input data: mean value & standard deviation
mD0=1200; stdD0=6; mD1=1000; stdD1=5; mF=1.3*10^6; stdF=1.2*10^5; mr=135; stdr=5.265; % variable h
syms h % mean value of limit state equation
mg = mr - 3*mF*(mD0-mD1)/(pi*mD1*h^(2))% variance of limit state equation
varg = stdr^(2) + (3*(mD0-mD1)*stdF/(pi*mD1*h^(2)))^(2) +... (3*mF*stdD0/(pi*mD1*h^(2)))^(2) + (3*mF*mD0*stdD1/(pi*mD1^(2)*h^(2)))^(2)% Standard deviation of limit state equation
stdg=sqrt(varg) vpa(stdg) A1=1/stdg; B=6*mF*(mD0-mD1)/(pi*mD1*h^3); beta=mg/stdg; f2 = matlabFunction(A1*B*(exp(-beta^2/2))/(2*pi)^(1/2));%Using fmincon command to solve The Robust Reliability Design
A=-1; b=-50; h0=50; lb = []; ub = []; Aeq = []; beq = []; nonlcon=@constrain; fmin = fmincon(f2,h0,A,b,Aeq,beq,lb,ub,nonlcon)
Here is constrain function:
%Constrain function
function [c, ceq] = constrain(h,mD0,stdD0,mD1,stdD1,mF,stdF,mr,stdr)mg = mr - 3*mF*(mD0-mD1)/(pi*mD1*h^(2));stdg= sqrt(stdr^(2) + (3*(mD0-mD1)*stdF/(pi*mD1*h^(2)))^(2) +...(3*mF*stdD0/(pi*mD1*h^(2)))^(2) + (3*mF*mD0*stdD1/(pi*mD1^(2)*h^(2)))^(2));c = (0.00336*stdg-mg);ceq = [];
Please help me to solve this problem. Thanks all so much!
Best Answer