Well, I am embarrassed to say that it was a simple code bug. In the prepareSurfaceData() function, I mixed up my vov_array and Vds array. The way I wrote my fitting equation, Vds is y, and vov is x.
Excluding and Weighting Data in a Surface Fit?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Paul Shepherd
el 18 de Abr. de 2014
Respondida: Paul Shepherd
el 19 de Abr. de 2014
I am trying to fit MOSFET parameters to a set of measured data, and I am having great success with fitting data to 1-D curves, but in the final step, I would like to optimize several previously-extracted parameters over a complete data set. To do this, I am excluding data where the MOSFET is not in saturation, and attempting to use the weighting function to obtain a fit that optimizes % error, instead of absolute error. Whether I turn off the weighting or not, this 2-D fitting step gives me a terrible fit, and I am wondering if I am not using the exclusion data (and the weighting data) correctly.
If I am not using it correctly, please let me know. Thanks! (to any EE's out there, I know the term for lambda is not what we normally use, but this is how Shichman and Hodges originally formulated it. By using this form and including 1+lambda*vds in both triode and saturation equations, you get a continuous derivative at the boundary between triode and saturation modes of operation.)
% Lots of code removed for brevity
% Data Structure description:
% IdVds_nfet contains arrays of Vds (2-D array of x-axis values), Vgs (1-D array of y-axis), and Id (2-D array of z-axis) Vds is a sweep variable, sampled close together, and Vgs is a step variable sampled much further apart.
%Vt, k', and lambda have been previously extracted via 1-D fits. Now, I am attempting to optimize the values of k' and lambda for best fit.
%now optimize parameters across the output curves above saturation
fit_func = fittype('(1+lambda*y)*k*x^2', 'numindep', 2);
nfet_fit_opts = fitoptions(fit_func);
%calculate the value of Voverdrive = Vgs-Vt
vov_array = repmat(IdVds_nfet.Vgs -nfet_vth, size(IdVds_nfet.Vds)./size(IdVds_nfet.Vgs));
% reshape the fitting data :(
[nfet_fit_x, nfet_fit_y, nfet_fit_z] = preparesurfacedata(IdVds_nfet.Vds, vov_array, IdVds_nfet.Id);
%exclude any data that is in triode from fit (Vds < Vov)
nfet_fit_opts.Exclude = nfet_fit_x < nfet_fit_y;
% weight fits to equalize % error instead of actual error
nfet_fit_opts.Weights = not(nfet_fit_opts.Exclude')./(nfet_fit_z.^2);
nfet_fit_opts.StartPoint = [k_n_mod, nfet_lambda];
nfet_fit_opts.Lower = 0.5*[k_n_mod, nfet_lambda];
nfet_fit_opts.Upper = 1.5*[k_n_mod, nfet_lambda];
[nfet_fit, gof] = fit([nfet_fit_x, nfet_fit_y], nfet_fit_z, fit_func, nfet_fit_opts)
And the result here gives me a very bad fit! It forces k' to it's minimum value even when I disable the weighting, so I believe the Exclude is the problem.
Thanks! (*edited to say that I am running this code in Matlab R2011a (Windows) or R2012 (Linux) )
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Curve Fitting Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!