How can I interpolate a multiinput-multioutput function in MATLAB based on scattered data?
4 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2020-12-16
回答: MathWorks Support Team
2020-12-16
Given is a matrix 'A' with size 'm' x 'n' which contains a set of scattered data. Integer 'n' can be split into 'n1' and 'n2', where 'n1' stands for the number of input variables and 'n2' stands for the output variables of a function f, such that '[y1, y2, ..., yn2] = f(x1, x2, ..., xn1)'. Then, integer 'm' stands for the number of provided pairs of tuples '(y1, y2, ..., yn2)' - '(x1, x2, ..., xn1)'. It is sought for a workflow that allows the intepolated output tuple '(yHat1, yHat2, ..., yHatn2)' of function 'f' on a new input tuple '(xHat1, xHat2, ...,xHatn1)'.
How can I interpolate a multiinput-multioutput function in MATLAB?
采纳的回答
MathWorks Support Team
2020-12-16
As of R2020b, there is no available method in MATLAB that allows the interpolation a multiinput-multioutput function based on scattered data. 'scatteredInterpolant' can only be used for up to 3 dimensions.
This workflow can be achieved by training a deep neural network on the provided pairs of tuples exploiting the 'featureInputLayer' for the input layer of the corresponding network. An example is provided in the following, that should serve as a demonstration and should be adjusted for a particular training task:
%% Number of input and output variables
numInput = n1;
numOutput = n2;
%% Definition of the training data
x = A(:, 1:numInput);
y = A(:, numInput + 1:end);
%% Definition of a sample layer architecture
layers = [ ...
featureInputLayer(numInput, "Name", "myFeatureInputLayer")
fullyConnectedLayer(8, "Name", "myFullyConnectedLayer1")
tanhLayer("Name", "myTanhLayer")
fullyConnectedLayer(numOutput, "Name", "myFullyConnectedLayer2")
regressionLayer("Name", "myRegressionLayer")
];
%% Definition of sample training options
opts = trainingOptions('adam', ...
'MaxEpochs', 1000, ...
'InitialLearnRate', 0.01,...
'Shuffle', 'every-epoch', ...
'Plots', 'training-progress', ...
'MiniBatchSize', 128, ...
'Verbose', false);
%% Training of the network
[trainedNet, info] = trainNetwork(x, y, layers, opts);
%% Compute a predicted output tuple on a new input tuple
% Please replace 'xHat' with the input vector of the actual application case
% in order to be able to run the following commands
% xHat = [xHat1 xHat2 ... xHatn1];
% yHat = predict(trainedNet, xHat)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!