curve fit using a custom equation from command line without using cftool
I have some data that is curve fitting nicely using custom equation from cftool. The equation is: y = aexp(-bx)+c. Is there any way to make this same equation available from the command line? For instance using fit command and exp1 gives following results:
f = fit(time,T102,'exp1')
f =
General model Exp1:
f(x) = a*exp(b*x)
Coefficients (with 95% confidence bounds):
a = 0.0726 (0.0717, 0.0735)
b = -1.263e-05 (-4.171e-05, 1.645e-05)
However the form of this equation does not fit my data well. I need to have the equation as f(x) = aexp(bx) + c. I am aware that I can get it from cftool but I have many different sets of data to curve fit (~30) and I just want a, b, and c returned from by MATLAB in the custom equation f(x) = aexp(bx) + c.
matlab curve-fitting
add a comment |
I have some data that is curve fitting nicely using custom equation from cftool. The equation is: y = aexp(-bx)+c. Is there any way to make this same equation available from the command line? For instance using fit command and exp1 gives following results:
f = fit(time,T102,'exp1')
f =
General model Exp1:
f(x) = a*exp(b*x)
Coefficients (with 95% confidence bounds):
a = 0.0726 (0.0717, 0.0735)
b = -1.263e-05 (-4.171e-05, 1.645e-05)
However the form of this equation does not fit my data well. I need to have the equation as f(x) = aexp(bx) + c. I am aware that I can get it from cftool but I have many different sets of data to curve fit (~30) and I just want a, b, and c returned from by MATLAB in the custom equation f(x) = aexp(bx) + c.
matlab curve-fitting
1
Is this link helpful? stackoverflow.com/questions/10890438/…
– James Phillips
Nov 11 at 20:05
add a comment |
I have some data that is curve fitting nicely using custom equation from cftool. The equation is: y = aexp(-bx)+c. Is there any way to make this same equation available from the command line? For instance using fit command and exp1 gives following results:
f = fit(time,T102,'exp1')
f =
General model Exp1:
f(x) = a*exp(b*x)
Coefficients (with 95% confidence bounds):
a = 0.0726 (0.0717, 0.0735)
b = -1.263e-05 (-4.171e-05, 1.645e-05)
However the form of this equation does not fit my data well. I need to have the equation as f(x) = aexp(bx) + c. I am aware that I can get it from cftool but I have many different sets of data to curve fit (~30) and I just want a, b, and c returned from by MATLAB in the custom equation f(x) = aexp(bx) + c.
matlab curve-fitting
I have some data that is curve fitting nicely using custom equation from cftool. The equation is: y = aexp(-bx)+c. Is there any way to make this same equation available from the command line? For instance using fit command and exp1 gives following results:
f = fit(time,T102,'exp1')
f =
General model Exp1:
f(x) = a*exp(b*x)
Coefficients (with 95% confidence bounds):
a = 0.0726 (0.0717, 0.0735)
b = -1.263e-05 (-4.171e-05, 1.645e-05)
However the form of this equation does not fit my data well. I need to have the equation as f(x) = aexp(bx) + c. I am aware that I can get it from cftool but I have many different sets of data to curve fit (~30) and I just want a, b, and c returned from by MATLAB in the custom equation f(x) = aexp(bx) + c.
matlab curve-fitting
matlab curve-fitting
asked Nov 11 at 12:54
PatStarks
5810
5810
1
Is this link helpful? stackoverflow.com/questions/10890438/…
– James Phillips
Nov 11 at 20:05
add a comment |
1
Is this link helpful? stackoverflow.com/questions/10890438/…
– James Phillips
Nov 11 at 20:05
1
1
Is this link helpful? stackoverflow.com/questions/10890438/…
– James Phillips
Nov 11 at 20:05
Is this link helpful? stackoverflow.com/questions/10890438/…
– James Phillips
Nov 11 at 20:05
add a comment |
1 Answer
1
active
oldest
votes
I ended up finding my answer using information from following link:
https://www.mathworks.com/help/curvefit/fit.html
Create a matlab function that contains custom equation for fit
function y = CustomCurveFitFunction(x,a,b,c)
y = aexp(-bx) + c;
end
Call the function in the following manner from MATLAB
ft = fittype('CustomCurveFitFunction(x, a, b, c)');
f = fit(time, y, ft);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248948%2fcurve-fit-using-a-custom-equation-from-command-line-without-using-cftool%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I ended up finding my answer using information from following link:
https://www.mathworks.com/help/curvefit/fit.html
Create a matlab function that contains custom equation for fit
function y = CustomCurveFitFunction(x,a,b,c)
y = aexp(-bx) + c;
end
Call the function in the following manner from MATLAB
ft = fittype('CustomCurveFitFunction(x, a, b, c)');
f = fit(time, y, ft);
add a comment |
I ended up finding my answer using information from following link:
https://www.mathworks.com/help/curvefit/fit.html
Create a matlab function that contains custom equation for fit
function y = CustomCurveFitFunction(x,a,b,c)
y = aexp(-bx) + c;
end
Call the function in the following manner from MATLAB
ft = fittype('CustomCurveFitFunction(x, a, b, c)');
f = fit(time, y, ft);
add a comment |
I ended up finding my answer using information from following link:
https://www.mathworks.com/help/curvefit/fit.html
Create a matlab function that contains custom equation for fit
function y = CustomCurveFitFunction(x,a,b,c)
y = aexp(-bx) + c;
end
Call the function in the following manner from MATLAB
ft = fittype('CustomCurveFitFunction(x, a, b, c)');
f = fit(time, y, ft);
I ended up finding my answer using information from following link:
https://www.mathworks.com/help/curvefit/fit.html
Create a matlab function that contains custom equation for fit
function y = CustomCurveFitFunction(x,a,b,c)
y = aexp(-bx) + c;
end
Call the function in the following manner from MATLAB
ft = fittype('CustomCurveFitFunction(x, a, b, c)');
f = fit(time, y, ft);
answered Nov 12 at 5:06
PatStarks
5810
5810
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248948%2fcurve-fit-using-a-custom-equation-from-command-line-without-using-cftool%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Is this link helpful? stackoverflow.com/questions/10890438/…
– James Phillips
Nov 11 at 20:05