Creating Equation from Data
显示 更早的评论
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 个评论
Ameer Hamza
2020-4-21
"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
2020-4-21
Ameer Hamza
2020-4-21
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!