search for: cxncnr

Displaying 1 result from an estimated 1 matches for "cxncnr".

Did you mean: concn
2012 Oct 22
1
Matlab code to R code
...e to match Matlab and r codes. R code: rr <- function(r,cxn) { tol <- 1E-4; for(i in 1:n) { t1 <- (1+(i-1)*r)*log((1+(i-1)*r)) t2 <- (i-1)*(1-r)*log(1-r) rri <- ((t1+t2)/i*log(i))-cxn rr <- rri > tol } round(rr,4) } rr1 <- rr(0.5,0.0242) ; rr1 Matlab code: function F = cxncnr(r) n = 4; % terms t1 = (1+(n-1)*r)*log((1+(n-1)*r)); t2 = (n-1)*(1-r)*log(1-r); %f = term - cxn f = (t1+t2)/(n*log(n)) - 0.05011007 F = [f]; % r0 = [0.5] ; r = fsolve(@cxncnr,r0) Thank you so much for any help given. [[alternative HTML version deleted]]