can you help me to find the minimum R in this code. What kind of iteration code could i use in this case?
1 view (last 30 days)
Show older comments
This is the code which i am working. I need to find the the correct m, s, and Lr in order to get R apporaximately zero.
please help.
rp = 5.89;
m = rp;
s = 3.84;
Lr = 5000;
lint = 0.36;
function f = unaccess(rs,m,s);
my = log(m/sqrt(1+s^2/m^2));
sig = sqrt(log(1+s^2/m^2));
%x = log(rs/m/(1+(s/m)^2)^3.5)/sqrt(2*log(1+(s/m)^2));
%f = (1+ erf(x))/2;
%x = (4*sig^2-log(rs)+my)/(sqrt(2)*sig);
%f = (1- erf(x))/2;
fun = @(r) r.^4./(r.*s.*sqrt(2.*pi)).*exp(-(log(r)-my).^2./(2.*sig.^2));
format long;
q1 = integral(fun,0,Inf,'RelTol',1e-8,'AbsTol',1e-13);
fun = @(r) r.^4./(r.*s.*sqrt(2.*pi)).*exp(-(log(r)-my).^2./(2.*sig.^2));
format long;
q2 = integral(fun,0,rs,'RelTol',1e-8,'AbsTol',1e-13);
f=q2/q1;
end
function f = access(rs,rp,m,s)
my = log(m/sqrt(1+s^2/m^2));
sig = sqrt(log(1+s^2/m^2));
fun = @(r) r.^4./(r.*s.*sqrt(2.*pi)).*exp(-(log(r)-my).^2./(2.*sig.^2));
format long;
q1 = integral(fun,0,Inf);
fun = @(r) r.^4.*(1-rs./r).^2.*(1+2.*(rs./r)-(1./3).*(rs./r).^2-(4./9).*(rs./r).^3)./(r.*s.*sqrt(2.*pi)).*exp(-(log(r)-my).^2./(2.*sig.^2));
format long;
q2 = integral(fun,rs,Inf);
f=q2/q1;
end
dj=[0.886/rp 1.032/rp 1.568/rp 2.179/rp 3.165/rp];
dCli=[0.997 0.991 0.881 0.468 0.016];
for i=1:5
dr(i) = dj(i)*rp ;
fnsi(i) = unaccess(dr(i),m,s) ;
fai(i) = access(dr(i),rp,m,s) ;
dCl(i)= (1-fnsi(i))*exp(-fnsi(i)*Lr);
R(i) = (dCl(i)-dCli(i))^2;
end
Rsum = sum( R);
thank you
0 Comments
Answers (0)
See Also
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!