Creating Equation from Data
Show older comments
Hi, I'm a relatively new user to Matlab and have hit a roadblock. I'm currently trying to generate an equation with three independent variables (Discharge_prist, Q_prist, Ch_slope) and one dependent variable (Infill_vol), with the dependent variable being a function of the three independent variables. The only function I could find to do this was fitlm (see code below) but I'm not sure if it's the best to use here based on the low confidence that came with the equation it generated from the data. Is there anything else I can use? Thanks!
Also, I do not have permission to attach the data for the 4 variables here so I included a line of code that generated random numbers for each variable. I don't necessarily need the an equation right now that works with the data, just a way to generate one.
discharge_prist=rand(100,1);
q_prist=rand(100,1);
ch_slope=rand(100,1);
infill_vol=rand(100,1);
TBL=table(discharge_prist,q_prist,ch_slope,infill_vol);
mdl=fitlm(TBL,'infill_vol~discharge_prist+q_prist+ch_slope')
3 Comments
Ameer Hamza
on 21 Apr 2020
"Is there anything else I can use?" It really depends on the mathematical model of the process that generated the data. If the linear model does not seems to fit well, then you need to find the nonlinear equations of your process. An infinite number of nonlinear models can be created, so the question of which one to use really boils down to what is the mathematical model of the process that generated the data.
Derrick Vaughn
on 21 Apr 2020
Ameer Hamza
on 21 Apr 2020
Derrick, in nlinfit(), beta0 is just the initial point for the optimization algorithm, and it is not a big issue. You can select it randomly or make an educated guess based on your model or data. The actual issue is, what is the formula for modelfun? You need to have an equation (with unknown parameters) that can relate the input observations to the output data. Then you can use the observed to find the unknown parameters.
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!