C++ to Matlab Quick Help

2 views (last 30 days)
Michael on 19 Nov 2013
IF I had some C++ that looked like:
Double_t fitfun(Double_t *x, Double_t *p)
const Double_t sigintr2 = 12.8*12.8; // %^2
const Double_t sigelec2 = p[0]*p[0];
const Double_t G = diethorn(x[0])/diethorn(2100.);
const Double_t out = TMath::Sqrt(p[1]*p[1]+sigintr2+sigelec2/G/G);
return out;
What would be the significance/translation of this? I feel liek it does a fit.. I have a function which calculates that diethorn (parameter) for use in that third line which looks like:
function G = diethornPar(V)
delV = 26.7; % volts
E_min =38.3e3; % volts(/m?)
a = 25.0e-4; % cm
lam_2pi = (V*0.735-73)/2/pi;
lnG = log(2)*lam_2pi/delV*log(lam_2pi/a/E_min);
G = exp(lnG);
If this is too detailed that's ok.
Thanks for your time, Michael

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!