Предполагая, что ваши входные данные расположены "случайно":
>> inputs = randn(400, 2);
>> outputs = inputs(:, 1) .* inputs(:, 2); % some function for the output
Вы могли бы просто построить scatter3 график этих данных:
>> scatter3(inputs(:, 1), inputs(:, 2), outputs)
![alt text](https://i.stack.imgur.com/TdZ1A.jpg)
Но лучший способ - это интерполировать, используя TriScatteredInterp , чтобы вы могли построить базовую функцию как поверхность:
% create suitably spaced mesh...
gridsteps_x = min(inputs(:, 1)):0.5:max(inputs(:, 1));
gridsteps_y = min(inputs(:, 2)):0.5:max(inputs(:, 2));
[X, Y] = meshgrid(gridsteps_x, gridsteps_y);
% Compute function to perform interpolation:
F = TriScatteredInterp(inputs(:, 1), inputs(:, 2), outputs);
% Calculate Z values using function F:
Z = F(X, Y);
% Now plot this, with original data:
mesh(X, Y, Z);
hold on
scatter3(inputs(:, 1), inputs(:, 2), outputs);
hold off
![alt text](https://i.stack.imgur.com/FQl4u.png)