How to use user input for fittype function
Show older comments
I want to take user inputs for a function and in turn use it in the fittype function. I realize that the fittype uses only string values so I converted my input to a string. However it is still not working and it keeps giving me this:
Error using fittype Expected a string for the parameter name, instead the input type was 'cell'.
Here is my code:
g=input('input your function','s')
f = fittype('g',{g});
nargs = numargs(f)
args = argnames(f)
args=sym(args)
and this is my input that I'm using for g:
a*x^2+b*exp(n*x)
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!