How to derive a function from 6 variables

조회 수: 6 (최근 30일)
Flavio Lupoli
Flavio Lupoli 2022년 11월 17일
댓글: Flavio Lupoli 2022년 11월 20일
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