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
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
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
FITNET Function fitting neural network. For an introduction use the Neural Fitting App nftool. Click here to launch it. Two (or more) layer fitting networks can fit any finite input-output relationship arbitrarily well given enough hidden neurons. fitnet(hiddenSizes,trainFcn) takes a row vector of N hidden layer sizes, and a backpropagation training function, and returns a feed-forward neural network with N+1 layers. Input, output and output layers sizes are set to 0. These sizes will automatically be configured to match particular data by train. Or the user can manually configure inputs and outputs with configure. Defaults are used if fitnet is called with fewer arguments. The default arguments are (10,'trainlm'). Here a fitting network is used to solve a simple fitting problem: [x,t] = simplefit_dataset; net = fitnet(10); net = train(net,x,t); view(net) y = net(x); perf = perform(net,t,y) See also FEEDFORWARDNET, PATTERNNET. Documentation for fitnet doc fitnet
  1 个评论
Flavio Lupoli
Flavio Lupoli 2022-11-20
Thank you! I'll give it a try. The number of data is not huge, so I don't think it causes many problems.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by