vand.m
来自「本压缩文件提供了matlab的时间序列工具箱」· M 代码 · 共 30 行
M
30 行
function V = vand(m, p)
%VAND Vandermonde matrix.
% V = VAND(P), where P is a vector, produces the (primal)
% Vandermonde matrix based on the points P, i.e. V(i,j) = P(j)^(i-1).
% VAND(M,P) is a rectangular version of VAND(P) with M rows.
% Special case: If P is a scalar then P equally spaced points on [0,1]
% are used.
% Reference:
% N. J. Higham, Accuracy and Stability of Numerical Algorithms,
% Second edition, Society for Industrial and Applied Mathematics,
% Philadelphia, PA, 2002; chap. 22.
if nargin == 1, p = m; end
n = length(p);
% Handle scalar p.
if n == 1
n = p;
p = linspace(0,1,n);
end
if nargin == 1, m = n; end
p = p(:).'; % Ensure p is a row vector.
V = ones(m,n);
for i=2:m
V(i,:) = p.*V(i-1,:);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?