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

📄 cubfit.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
%FUNCTION CUBFIT finds the cubic polynomial to fit the given two points.
%         
% [cof,yi]=cubfit(x,y,xi);
% INPUT :   [x(1) x(2)] and [y(1) y(2)] are the given two knobs 
%           xi == new abscissa vector
%             
% OUTPUT :     yi == the corresponding vector to xi
%             cof == the coefficients that describe the cubic polynomial
%
%       where, w(t)= cof(1)*x^3+cof(2)*x^2+cof(3)*x+cof(4)

function [cof,yi]=cubfit(x,y,xi)

% 1.  construct the matrix
x1=x(1);
x2=x(2);

A=[x1^3   x1^2 x1 1;
   x2^3   x2^2 x2 1;
   3*x1^2 2*x1 1  0;
   3*x2^2 2*x2 1  0];

Y=[y(1); y(2); 0; 0];

cof=inv(A)*Y;

if nargout>1
   yi=polyval(cof,xi);
end

⌨️ 快捷键说明

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