I am trying to use the cftool options in MATLAB and I have
gotten confused by the syntax.
I am trying to change the options by writing the lines of
code that will change the default algorithm solver
from "Trust-Region" to "Gauss-Newton". I put in the code
to change that option but this is the error that I got.
s = fitoptions('Method','Gauss-Newton');
pl= cfit(f,162e-7,680e-9,10e-2,'options',s)
??? Error using ==> fitoptions>findmethod at 232
Method name "Gauss-Newton" is not valid.
Error in ==> fitoptions at 168
token = findmethod(methodvalue);
Error in ==> PIT_no_wall at 66
s = fitoptions('Method','Gauss-Newton');
I am also trying to make 162e-7, 680e-9, and 10e-2 my
starting guess values for my three constants. Could
someone help my figure out what is wrong with my code.
"Ender " <jr147@msstate.edu> wrote in message
<g55o5g$7ru$1@fred.mathworks.com>...
> I am trying to use the cftool options in MATLAB and I
have
> gotten confused by the syntax.
>
> I am trying to change the options by writing the lines
of
> code that will change the default algorithm solver
> from "Trust-Region" to "Gauss-Newton". I put in the code
> to change that option but this is the error that I got.
>
> s = fitoptions('Method','Gauss-Newton');
> pl= cfit(f,162e-7,680e-9,10e-2,'options',s)
>
> ??? Error using ==> fitoptions>findmethod at 232
> Method name "Gauss-Newton" is not valid.
>
> Error in ==> fitoptions at 168
> token = findmethod(methodvalue);
>
> Error in ==> PIT_no_wall at 66
> s = fitoptions('Method','Gauss-Newton');
>
>
> I am also trying to make 162e-7, 680e-9, and 10e-2 my
> starting guess values for my three constants. Could
> someone help my figure out what is wrong with my code.
>
> --Ender--
>
>
I figured out the answer to this problem. My next
question is how do I put each individual answer into its
own variable.
My code was:
Lemer = coeffvalues(c)
My output was:
Lemer =
12 23 83
How do I take each number and put it into it's own
variable? Meaning:
"Ender " <jr147@msstate.edu> wrote in message <g55qbf$4c6
$1@fred.mathworks.com>...
> "Ender " <jr147@msstate.edu> wrote in message
> <g55o5g$7ru$1@fred.mathworks.com>...
> > I am trying to use the cftool options in MATLAB and I
> have
> > gotten confused by the syntax.
> >
> > I am trying to change the options by writing the lines
> of
> > code that will change the default algorithm solver
> > from "Trust-Region" to "Gauss-Newton". I put in the
code
> > to change that option but this is the error that I got.
> >
> > s = fitoptions('Method','Gauss-Newton');
> > pl= cfit(f,162e-7,680e-9,10e-2,'options',s)
> >
> > ??? Error using ==> fitoptions>findmethod at 232
> > Method name "Gauss-Newton" is not valid.
> >
> > Error in ==> fitoptions at 168
> > token = findmethod(methodvalue);
> >
> > Error in ==> PIT_no_wall at 66
> > s = fitoptions('Method','Gauss-Newton');
> >
> >
> > I am also trying to make 162e-7, 680e-9, and 10e-2 my
> > starting guess values for my three constants. Could
> > someone help my figure out what is wrong with my code.
> >
> > --Ender--
> >
> >
> I figured out the answer to this problem. My next
> question is how do I put each individual answer into its
> own variable.
>
> My code was:
> Lemer = coeffvalues(c)
>
> My output was:
> Lemer =
> 12 23 83
>
>
> How do I take each number and put it into it's own
> variable? Meaning:
>
> a = 12
> b = 23
> c = 83
>
>
> -Ender-
"Ender " <jr147@msstate.edu> wrote in message
<g55qrn$9hj$1@fred.mathworks.com>...
> "Ender " <jr147@msstate.edu> wrote in message <g55qbf$4c6
> $1@fred.mathworks.com>...
> > "Ender " <jr147@msstate.edu> wrote in message
> > <g55o5g$7ru$1@fred.mathworks.com>...
> > > I am trying to use the cftool options in MATLAB and
I
> > have
> > > gotten confused by the syntax.
> > >
> > > I am trying to change the options by writing the
lines
> > of
> > > code that will change the default algorithm solver
> > > from "Trust-Region" to "Gauss-Newton". I put in the
> code
> > > to change that option but this is the error that I
got.
> > >
> > > s = fitoptions('Method','Gauss-Newton');
> > > pl= cfit(f,162e-7,680e-9,10e-2,'options',s)
> > >
> > > ??? Error using ==> fitoptions>findmethod at 232
> > > Method name "Gauss-Newton" is not valid.
> > >
> > > Error in ==> fitoptions at 168
> > > token = findmethod(methodvalue);
> > >
> > > Error in ==> PIT_no_wall at 66
> > > s = fitoptions('Method','Gauss-Newton');
> > >
> > >
> > > I am also trying to make 162e-7, 680e-9, and 10e-2
my
> > > starting guess values for my three constants. Could
> > > someone help my figure out what is wrong with my
code.
> > >
> > > --Ender--
> > >
> > >
> > I figured out the answer to this problem. My next
> > question is how do I put each individual answer into
its
> > own variable.
> >
> > My code was:
> > Lemer = coeffvalues(c)
> >
> > My output was:
> > Lemer =
> > 12 23 83
> >
> >
> > How do I take each number and put it into it's own
> > variable? Meaning:
> >
> > a = 12
> > b = 23
> > c = 83
> >
> >
> > -Ender-
>
>
> I solved this problem as well Thanks though!
I have another problemm
I cannot figure out why the curvefitting tool will not use
my intial guess when trying to fit the curve that I
specified. I wrote the code so that I would input the same
initial conditions, but whenever I run the program. MATLAB
warns me that I have not specified intitial guesses so
MATLAB then chooses its own initial guess. Because of that
I get different coefficients whenever I run the program. I
need help writing the code to input the same starting
guess values.
Here is my code:
% Define the options for the curve fit & the independent
variable
s = fitoptions('Method','NonlinearLeastSquares',...
'Algorithm','Gauss-Newton');
f = fittype('a+b*(1-exp(-
t/c))','independent','t','options',s);
% Displays the independent & dependent variable,
Coeffiecient names
indep = indepnames(f)
dep = dependnames(f)
coeffs = coeffnames(f)
% Establish first guess of Coefficients for algorithm
pl= fit(f,162e-7,680e-9,10e-2);
% Determine Coefficients
KO = fit(t,y,pl);
KO
I would like to state my initial guesses in the "pl"
variable, which I thought I was doing.
> I have another problemm
...
> pl= fit(f,162e-7,680e-9,10e-2);
>
> % Determine Coefficients
> KO = fit(t,y,pl);
Ender, in the first line above I'm not sure what you were trying to do. I
would think you would just want to assign your starting values to a vector:
pl= [162e-7,680e-9,10e-2];
In the last line, you have not included anything in the call to indicate
what kind of fit you want to make. I assume you intend to do something like
this:
"Tom Lane" <tlane@mathworks.com> wrote in message
<g57mco$8iv$1@fred.mathworks.com>...
> > I have another problemm
> ...
> > pl= fit(f,162e-7,680e-9,10e-2);
> >
> > % Determine Coefficients
> > KO = fit(t,y,pl);
>
> Ender, in the first line above I'm not sure what you
were trying to do. I
> would think you would just want to assign your starting
values to a vector:
>
> pl= [162e-7,680e-9,10e-2];
>
> In the last line, you have not included anything in the
call to indicate
> what kind of fit you want to make. I assume you intend
to do something like
> this:
>
> fit(t,y,f,'start',p1)
>
> -- Tom
>
>
What you suggested worked thanks!!
--Ender--
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.