# MVAM125 varactor capacitance curve fitting - Claudio Girardi, IN3OTD, 2008 # version with data point weighting # c(x) = c0/((1+x/v0) ** m) # function to be fit c0 = 1000; v0 = 0.5; m = 0.5; # initial guess for c0, v0 and m set fit logfile "mvamfitw.log" fit c(x) 'MVAM125.dat' using 1:2:2 via c0, v0, m set key title "c(v) = c0/((1 + v/v0) ^ m)\n" # title to key set title "MVAM125 capacitance and curve fit" set pointsize 1.5 # larger point set xlabel 'Voltage [V]' set ylabel 'Capacitance [pF]' set xrange [0:26] set yrange [10:1000] set ytics (10,20,50,100,200,500,1000) set logscale y set grid plot 'MVAM125.dat' using 1:2 title 'Datasheet' with points 3, \ c(x) title sprintf('Curve-fit; c0 = %f, v0 = %f, m = %f', c0, v0, m) set term push # save current terminal settings # write the graph in PNG format set terminal png set output "MVAM125_Cfit_w.png" replot; set term pop # restore saved terminal settings # show error in curve fit set title "MVAM125 curve fit error" set key left top default set ylabel 'error [%]' set yrange [-5:5] set ytics autofreq unset logscale y plot 'MVAM125.dat' using 1:(100 * (1 - c($1)/$2)) with linesp set term push # save current terminal settings # write the graph in PNG format set terminal png set output "MVAM125_Cfit_w_error.png" replot; set term pop # restore saved terminal settings