polyn2sympoly.m

来自「多项式拟合的MATLAB工具。只要具有以下几个函数 POLYFITN - A 」· M 代码 · 共 47 行

M
47
字号
function sp = polyn2sympoly(polyn)% polyn2sympoly: convert a regression polynomial from polyfitn into a sympoly% usage: sp = polyn2sympoly(polyn)%% arguments: (input)%  polyn - a structure as returned from polyfitn%% arguments: (output)%  sp - A sympoly object%% After conversion into a sympoly, any symbolic operations are% now possible on this form.% % Requirement: The sympoly toolbox, as found on Matlab Central.% http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=9577&objectType=FILE%% See also: polyvaln, polyfit, polyval, sympoly%% Author: John D'Errico% Release: 1.0% Release date: 2/19/06if exist('sympoly','file')~=2  error 'Please download the sympoly toolbox from Matlab Central'endsp = sympoly(0);% Copy over the fields of polyn into spsp.Var = polyn.VarNames;sp.Exponent = polyn.ModelTerms;sp.Coefficient = polyn.Coefficients(:);% Was the list of variable names empty?% If so, then generate a list of names of my own.if isempty(sp.Var)  p = size(polyn.ModelTerms,2);  varlist={};  for i = 1:p    varlist{i} = ['X',num2str(i)];  end  sp.Var = varlist;end

⌨️ 快捷键说明

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