Is it possible to display Rsquared value or parameter value on each iteration in fit?
1 view (last 30 days)
Show older comments
I am hoping to use print statements possibly using the 'fit' call in order to see what the curve fitting toolbox is doing on each iteration. Here is the code I have for the fitter:
[fit_result, gof, fit_info] = fit(xdata, ydata,ft,...
'problem', const_vals,'Lower', lower_bound, 'Upper', upper_bound, 'DiffMinChange', min_diff);
Note: as an aside, the 'ft' is a user specified fittype based on simulated data given by a linear solver. I am curious if putting a display inside the fittype which is an external function would work. Here is that code:
ft = fittype('LTfitWrap(Vds, Vgs, mtrlmod, cgs, cds, cgd0, coxd, vtd, vtdtco, fc, m, wb, nb, a, agd, thetal, thetalr, thetah, thetaltexp, thetahtexp, kfl, kfh, kpl, kph, kflr, kplr, kfltexp, kfhtexp, kpltexp, kphtexp, vtl, vth, vtlr, vtltco, vthtco, vbigd, pvfl, pvfh, slmin, id0, vb, rs, rd, rdr, rdvd, rdvg11, rdvg12, rdtemp1, rdtemp2, rdvdtemp1, rdvdtemp2, rdiode, is_body, kvsg1, kvsg2, nd, temperature, tnom, vk1, vk2, tt, tau, multiplier, p_delta, thetalrtexp, kplrtexp, rdrtemp1, rdrtemp2, rdiodetemp1, rdiodetemp2, vtlrtco, vk1tco, vk2tco, ndtco, kvsg1texp, kvsg2texp)',...
'independent', {'Vds','Vgs'},...
'dependent', {'ydata'},...
'problem', const_vars,...
'coefficients', opt_params);
My assumption is that the curve fitting toolbox here checks different 'const_vals' against the data and checks with 'min_diff' to see if the change in the data met this requirement. This would happen over and over again until the condition is met. So my question is, is it possible to print the Rsquare value and the 'const_vals' value on each iteration so I can see in the command window what values the fit is choosing, the correlation (Rsquare) at that moment, and possibly the change that is witnessed (in this case it will obviously keep outputting a value higher than 'min_diff' because when that condition is met it will output the values that are chosen to meet that criteria).
If this question does not make sense, please feel free to ask for more insight. I just want to be able to print inside the 'fit' as it is looping through different values to make sure the optimization is working properly.
Thanks!
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression 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!