Fit surface to data set

2 次查看(过去 30 天)
So, I've got this data set with 3 vars (attached), time, temperature and percentage conversion. It's from a FAMEs chemical reaction, and i've been using fruitessly cftool, to get a surface function that fits to data. Any suggestions on how to do this?
The aim is to predict percentage conversion by setting temp and time based on experimental data :D
Thanks!

采纳的回答

Star Strider
Star Strider 2014-6-25
I don’t have the Curve Fitting Toolbox, but using the Statistics Toolbox function nlinfit or Optimization Toolbox function lsqcurvefit, it would be relatively easy. Assuming time and temperature are your independent variables, and percentageconversion your dependent variable, combine the first two in one matrix and then regress it against the third using your function.
Example:
TimeTemp = [time temperature]; % Assumes time and temperature are COLUMN vectors
FAMEfcn = (b,X) b(1).*X(:1) + b(2) .* X(:,2); % FAME = K1*time + K2*temperature
B = nlinfit(TimeTemp, percentageconversion, FAMEfcn, [1 1])
Obviously you would provide the function to fit. I created the very simple example FAMEfcn to illustrate how to refer to the TimeTemp variables within it. The percentageconversion vector is also assumed to be a column vector here.
  2 个评论
Juan Carlos
Juan Carlos 2014-6-25
Thanks, I'll give it a try, yet the bigger issue is the function to provide. I'll keep working on it.

请先登录,再进行评论。

更多回答(1 个)

John D'Errico
John D'Errico 2014-6-25
Nonlinear models are difficult. They are often difficult to choose in 1-d. It gets nastier in 2-d.
For this reason, people often choose polynomial models. And, well, they have their dramatic downsides too. But you can always use my polyfitn, found on the file exchange.
Given a complete lack of an intelligent choice for a model, gridfit is a decent option. It is also found on the file exchange.
  5 个评论
Juan Carlos
Juan Carlos 2014-6-26
We have kinetic models, but we are trying regression to compare forecasts. Thanks a los for the answers and comments.
Star Strider
Star Strider 2014-6-26
I got the impression you were estimating the model parameters. It is statistically permissible to extrapolate the fit of a kinetic model if you understand the model and the validity of the numbers you are calculating from it.
If you need help fitting the model with nlinfit or lsqcurvefit, post it and some data here (at least as many data sets as you have parameters in your model). I’ll do my best to help.
I only use polynomial fits when I want to get some idea of what noisy data ‘look like’, or if I want to interpolate intermediate estimates. I never use them to extrapolate, because it is impossible to know what the data are in the region you have not measured. No matter what the polynomial does, you have no idea that what you extrapolate reflects the actual behaviour of the system you are measuring. The polynomial could be dead-on or wildly off-course.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by