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

📄 lspoly.m

📁 关于数值计算的matlab程序代码,包含了很多的实用的算法.程序全部可以直接用的,有详细的英文注释.
💻 M
字号:
function C = lspoly(X,Y,M)%Input   - X is the 1xn abscissa vector%        - Y is the 1xn ordinate vector%        - M is the degree of the least-squares polynomial% Output - C is the coefficient list for the polynomial%  NUMERICAL METHODS: Matlab Programs% (c) 2004 by John H. Mathews and Kurtis D. Fink%  Complementary Software to accompany the textbook:%  NUMERICAL METHODS: Using Matlab, Fourth Edition%  ISBN: 0-13-065248-2%  Prentice-Hall Pub. Inc.%  One Lake Street%  Upper Saddle River, NJ 07458n=length(X);B=zeros(1:M+1);F=zeros(n,M+1);%Fill the columns of F with the powers of Xfor k=1:M+1   F(:,k)=X'.^(k-1);end%Solve the linear system from (25)A=F'*F;B=F'*Y';C=A\B;C=flipud(C);

⌨️ 快捷键说明

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