⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ratcof.m

📁 matlab高级统计工具箱
💻 M
字号:
function [a,b]=ratcof(xdata,ydata,ntop,nbot)
% [a,b]=ratcof(xdata,ydata,ntop,nbot)
% Determine a and b to approximate ydata as a rational
% function of the variable xdata. The function has the form:
%
%      y(x) = sum(1=>ntop)( a(j)*x^(j-1) ) /
%	   ( 1 + sum(1=>nbot)( b(j)*x^(j)) )
%
%   xdata,ydata     input data vectors (real or complex)
%   ntop,nbot       number of series terms used in the
%                   numerator and the denominator.
%		    If nbot not entered nbot=ntop unstable for large ntop>10
%
%     Use RATERP to calc y(x)

%	     H.B.Wilson, Oct 1988-Modified A.Jutan-Jan 90

ydata=ydata(:);  xdata=xdata(:); m=length(ydata);
if nargin==3, nbot=ntop; end;
x=ones(m,ntop+nbot);  x(:,ntop+1)=-ydata.*xdata;
for i=2:ntop, x(:,i)=xdata.*x(:,i-1); end
for i=2:nbot, x(:,i+ntop)=xdata.*x(:,i+ntop-1); end
ab=x\ydata; a=ab(1:ntop); b=ab(ntop+1:ntop+nbot);

⌨️ 快捷键说明

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