ratinterp.m

来自「Mathematical Methods by Moor n Stiling.」· M 代码 · 共 30 行

M
30
字号
function [N,D] = ratinterp(ts,fs)  
% 
% Compute the rational function interpolation
% from the data in ts and fs.
% Polynomial coefficients returned in Matlab order (largest to smallest)

% function [N,D] = ratinterp(ts,fs)  
%
% ts = vector of independent data
% fs = vector of dependent data
%
% N = numerator coefficients
% D = denominator coefficients

% Copyright 1999 by Todd K. Moon

n = length(ts);
phis = invdiff(ts,fs);
% Build up the approximation from the bottom up
D = 1;
N = phis(n);
for j=n-1:-1:1
  oldD = D;
  D = N;                    % flip the last one upside down
  N = [0 oldD] - ts(j)*[oldD 0]; % multiply the polynomials
  k=1:length(D);
  N(k) = phis(j)*D(k) + N(k); % find the new numerator
end
N = N(length(N):-1:1);      % reverse to put in standard Matlab order
D = D(length(D):-1:1);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?