Home > other >  Can someone help me to look at how to use matlab in combination with the two functions
Can someone help me to look at how to use matlab in combination with the two functions

Time:04-30

The function z=Untitled1 (p, rx and ry, rho, z0, tau, n)
Rx=rx/SQRT (n);
Ry=ry/SQRT (n);
W=tau z0 * * rx/ry;
C1=1/power (ry, 2) - power (norminv (p), 2);
C2=2 * w * (rho * power (norminv (p), 2) - 1/(rx * ry));
C3=power (w, 2) * (1/power (rx, 2) - power (norminv (p), 2));
If p> 0.5
Z=(c2 + SQRT (power (c2, 2) - 4 * c1 * c3))/2 * c2.
The else
Z=(- c2 - SQRT (power (c2, 2) - 4 * c1 * c3))/2 * c2.
End
End
Tau=1;
Rx=0.01;
Ry=0.01;
Rho=0.8;
N=5;
Z0=1;
A=0.005;
P1=1 - a/2;
The p2=a/2;
UCL=Untitled1 (p1, rx and ry, rho, z0, tau, n);
LCL=Untitled1 (p2, rx and ry, rho, z0, tau, n);


ARL0=200;
Rx=0.2;
Ry=0.2;
Z0=1;
Rho=0.8;
Tau=1.1;
N0=15;
ARL1=10000;
The options=optimset (' MaxIter '15000,' TolFun, 1 e - 10, 'TolX, 1 e - 10);
For ns=1: n0-1
For nl=n0 + and
K (1)=getucl (rx and ry, rho, ns, ARL0);
K (2)=getucl (rx and ry, rho, nl, ARL0);
X=[k (1), k (2), 1 + (1) (k - 1) * 0.4, 1 + (2) (k - 1) * 0.6]; The initial value of x % set themselves up (1), x (2), x (3), x (4)
% x=[1.007598, 1.007597, 1.00, 1.000708];

[x, fval, exitflag, output]=fmincon (@ vssfun1 (x) (x, ns, nl, rx and ry, rho, tau, z0), [x (1), x (2), x (3), x (4)], [1,1,0,0; 1,0,1,0; 0, 1, 1], [0, 0, 0], [], [], [,1,0.9 1, 0.9], [5,5,5,5], @ vssfun2 (x) (x, rx and ry, rho, z0, ns, nl, n0), the options).
% [x, fval, exitflag, output]=fminsearch (@ psovssrz3 (x) (x, ns, nl, rx and ry, rho, tau, z0, n0), [x (1), x (2), x (3), x (4)], the options).
% opts=optimoptions (@ fsolve, 'Algorithm', 'levenberg - marquardt', 'MaxIter' 1500, 'MaxFunEvals' 1500,' TolX, 1 e - 8, 'TolFun, 1 e - 8).
% [w, fval, exitflag]=fsolve (@ (x) optw (x, rx and ry, rho, z0, ns, nl, n0, k), (1, 1), opts);
% [x, fval, exitflag]=fsolve (@ myfun (x) (x, rx and ry, rho, z0, ns, nl, ARL0, n0), [k (1), k (2), 1.0001, 1.0001], opts);

[ARL, SDRL]=getARL (x, rx and ry, rho, tau, z0, ns, nl);
If (ARL 0)
ARL1=ARL;
SDRL1=SDRL;
ASS1=getASS (x, rx and ry, rho, tau, z0, ns, nl);
Ns1=ns;
Nl1=nl;
X1=x;

End
End
End
Allparameters=[ns1, nl1, x1, ARL1, ASS1, SDRL1];
  • Related