Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: get fit coefficients from fitting result
Replies: 5   Last Post: May 28, 2013 10:59 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Tom Lane Posts: 858 Registered: 12/7/04
Re: get fit coefficients from fitting result
Posted: Feb 6, 2012 2:30 PM
 Plain Text Reply

> 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

Date Subject Author
2/6/12 Marzieh
2/6/12 Tom Lane
5/25/13 Gabriele
5/28/13 Steven Lord

© The Math Forum at NCTM 1994-2018. All Rights Reserved.