How to derive a function from 6 variables
6 次查看(过去 30 天)
显示 更早的评论
I have a nx1 column array A and a nx6 matrix B. Every line of the matrix B corresponds to a value in the same line of A. I want to "interpolate" these values (not sure if it is the right term) so that I obtain a function that puts in correlation every line of B with the correspondent line of A (so basically, a function f of six variables). Which Matlab function should I use?
1 个评论
VBBV
2022-11-17
Search in the google god. You will find many results suggesting which function to use. Or use the help centre of matlab website to find more info about those functions.
采纳的回答
John D'Errico
2022-11-17
编辑:John D'Errico
2022-11-17
Knowing which function to use, given 6 independent variables is terribly difficult to know. If you lack knowledge of a good nonlinear form, it is often the case you want to use simple, LOW order polynomial models. A linear model would be a start, so linear in 6 variables. Even there you will have 7 parameters to estimate. (Don't forget the constatn term.)
That fit requires nothing more than:
% coeffs = [B,ones(n1)]\A;
So the constant term will be the last coefficient in that list.
I don't know how much data you have, but that is where I would start. Beyond that point, beware, as there lie dragons. Far too many people want to fit high order polynomials. And that is often a bad idea. At most, I might suggest a 2nd order polynomial model. You could use my polyfitn, as found on the file exchange. But as I said, far too many abuse this sort of thing, not realizing how difficult polynomials can get in high dimensions.
If you find the fit is inadequate with the linear polynomial, AND you have sufficient data to build a neural net model, I would go in that direction. Of course, it would require you learn to use those tools. You might start looking here:
help fitnet
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!