How can I form equation from my data?

2 views (last 30 days)
I'm doing analysis of water gas shift reactor. In that I want to find out rate of reaction equation in terms of mole fraction of species. If i use curve fitting or surface fitting i can generate function in terms of only one or two species at once. how can i generate function in terms of all four species. I've 4 species which i have to include to form equation of rate of reaction.
  2 Comments
Yu Jiang
Yu Jiang on 6 Aug 2014
Do you want to perform linear regress or nonlinear regression on your data set? If nonlinear, do you have a specific type of function in mind? Can you share part of your data?
Shashank Thakker
Shashank Thakker on 7 Aug 2014
I want to generate function to define relationship between reaction rate and mole fraction of species. I've four species. CO,CO2,H2,H2O. So how can i do that by using matlab. If I change value of H2O molefraction with other values as constant it shows that reaction rate increases with increase in h2o mole fraction. With co first it increase and than it decreases with c mole fraction. Here i'm sharing you some of my results as attachment. Can you guide me how CAN I generate function by using matlab? Can regression method be used? Which linear or non linear? Kindly guide me to solve my query. I would be grateful to me.
Thank you Shashank Thakker

Sign in to comment.

Accepted Answer

ameen
ameen on 6 Aug 2014
You should think about regression to get a relation between these 4 variables and the rate of reaction. If you don't know about regression please don't waste your time learning it on Matlab. Read about the basics of regression or watch videos on youtube.

More Answers (1)

Yu Jiang
Yu Jiang on 8 Aug 2014
Edited: Yu Jiang on 9 Aug 2014
Hi Shashank
I understand that you would like to perform regression on your data set using MATLAB. In particular, you would like to obtain a function in the following form
Rate = F(CO, CO2, H2, H2O)
where it is not clear what is the best type of functions that should be used here.
I suggest you first try linear regression by using the function regress (Documentation) .
A linear model for this problem looks like
Rate = b(1) * CO + b(2) * CO2 + b(3) *H2 + b(4) *H2O +b(5)
where b is a constant vector of 5 elements. To fit this model in MATLAB, you may try the following steps:
1) Create a matrix X, which is an n-by-5 matrix. The first 4 columns contain the observation from the four species. The fifth column is a column of ones. 2) Create an n-by-1 matrix y, which contains the rate from n different observations.
3) In the MATLAB Command window, try executing the following
>> [b,bint,r] = regress(y,X)
Then, b is the vector of coefficients for the linear model. bint returns the related confidence interval, and r gives the residuals based on which you can see if the fitting is acceptable. To see the difference between the actual data and the data generated by the model, you can simply try
>> n = length(y)
>> plot(1:n, y, o,1:n, X*b )
In which ‘o’ denotes the actual data, and X*b gives you the predicted results. If you would like to perform nonlinear regression, you may want to use the function fitnlm (Documentation) . However, it is necessary that you know the nonlinear structure of the function and can parameterize it with a vector b. I would like to suggest you read related literature and see if some particular structure of nonlinear functions has been used by other people.
-Yu

Community Treasure Hunt

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

Start Hunting!