📄 subsref.m
字号:
function y=subsref(r,s)%SUBSREF(R,S) Subscripted Reference for Rational Polynomial Objects. (MM)% R('z') returns a new rational polynomial object having the same numerator% and denominator, but using the variable 'z'.%% R(x) where x is a numerical array, evaluates the rational polynomial R% at the points in x, returning an array the same size as x.%% R.n returns the numerator row vector of R.% R.d returns the denominator row vector of R.% R.v returns the variable associated with R.% D.C. Hanselman, University of Maine, Orono ME 04469% 3/27/98, 3/1/99% Mastering MATLAB 6, Prentice Hall, ISBN 0-13-019468-9if length(s)>1 error('MMRP Objects Support Single Arguments Only.')endif strcmp(s.type,'()') % R( ) arg=s.subs{1}; argc=class(arg); if strcmp(argc,'char') if strcmp(arg(1),':') error('MMRP Objects Do Not Support R(:).') else y=mmrp(r.n,r.d,arg(1)); end elseif strcmp(argc,'double') if length(r.d)>1 y=polyval(r.n,arg)./polyval(r.d,arg); else y=polyval(r.n,arg); end else error('Unknown Subscripts.') endelseif strcmp(s.type,'.') % R.field arg=lower(s.subs); switch arg(1) case 'n' y=r.n; case 'd' y=r.d; case 'v' y=r.v; otherwise error('Unknown Data Requested.') endelse % R{ } error('Cell Addressing Not Supported.') end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -