Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: get fit coefficients from fitting result
Posted:
Feb 6, 2012 2:30 PM


> Does anyone know how can I save a set of coefficients for different values > of k for example. > I have k=0.00475 and do the fitting,using coeffvalues I get 'g' as a 1 by > 2 matrix 0.002 0.63, > then I want to have it for k ranging from 0 to 0.008 with step size 0.001;
I can't tell what your code is trying to do, but here's how I would approach a problem like this:
load census format short g kk = [.25 .5 1 1.5]; coeffs = zeros(length(kk),2); for j=1:length(kk) k = kk(j); f = fit(cdate,pop.^k,'poly1'); coeffs(j,:) = coeffvalues(f); end
 Tom



