【发布时间】:2017-01-23 18:15:45
【问题描述】:
我们得到一个 n x n 的数据。近似函数。 例如。如果给定 2(1,1), 3(1,2), 4(2,1), 5(2,2) 然后我们必须将 2 D- ultinomial 内插为 $0*x*y+y+2*x-1$。
【问题讨论】:
标签: matlab 2d multinomial
我们得到一个 n x n 的数据。近似函数。 例如。如果给定 2(1,1), 3(1,2), 4(2,1), 5(2,2) 然后我们必须将 2 D- ultinomial 内插为 $0*x*y+y+2*x-1$。
【问题讨论】:
标签: matlab 2d multinomial
这个问题可以表述为一组线性方程,使用mldivide 函数很容易解决。
让我用你提供的例子来说明这一点。
% from the given example
in = [...
1,1;
1,2;
2,1;
2,2];
out = [...
2;
3;
4;
5];
% compute the variable terms in the polynomial
x = in(:,1);
y = in(:,2);
xy = x .* y;
c = ones(size(out)); % constant
% compute the coefficients of the polynomial
p = [xy,y,x,c] \ out;
% result: [0; 1; 2; -1]
语句p = [xy,y,x,c] \ out 在问题受到过度约束(即不存在完全满足所有方程的解)时计算最优系数(最小二乘误差)。但是,如果方程的数量与变量的数量一样多(如本例中,由于 4 个输入-输出对有 4 个方程,并且有 4 个系数需要估计),那么系数可以简单地通过 @ 计算987654324@.
【讨论】: