The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic 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);

-- Tom

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

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