利用matlab实现Lagrange 插值多项式主程序为:function SF_Sinx = -5 : 0.01 : 5; y = sin(x); plot(x,y,'r:') % 绘制准确函数图像hold onpx = -5 : 1 : 5; % 插值点py = sin(px
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/05 15:19:07
![利用matlab实现Lagrange 插值多项式主程序为:function SF_Sinx = -5 : 0.01 : 5; y = sin(x); plot(x,y,'r:') % 绘制准确函数图像hold onpx = -5 : 1 : 5; % 插值点py = sin(px](/uploads/image/z/2685734-62-4.jpg?t=%E5%88%A9%E7%94%A8matlab%E5%AE%9E%E7%8E%B0Lagrange+%E6%8F%92%E5%80%BC%E5%A4%9A%E9%A1%B9%E5%BC%8F%E4%B8%BB%E7%A8%8B%E5%BA%8F%E4%B8%BA%EF%BC%9Afunction+SF_Sinx+%3D+-5+%3A+0.01+%3A+5%3B+++++++++++++y+%3D+sin%28x%29%3B+++++++++++++++++++plot%28x%2Cy%2C%27r%3A%27%29+++++++++++++++++%25+%E7%BB%98%E5%88%B6%E5%87%86%E7%A1%AE%E5%87%BD%E6%95%B0%E5%9B%BE%E5%83%8Fhold+onpx+%3D+-5+%3A+1+%3A+5%3B+++++++++++++++%25+%E6%8F%92%E5%80%BC%E7%82%B9py+%3D+sin%28px)
利用matlab实现Lagrange 插值多项式主程序为:function SF_Sinx = -5 : 0.01 : 5; y = sin(x); plot(x,y,'r:') % 绘制准确函数图像hold onpx = -5 : 1 : 5; % 插值点py = sin(px
利用matlab实现Lagrange 插值多项式
主程序为:
function SF_Sin
x = -5 : 0.01 : 5;
y = sin(x);
plot(x,y,'r:') % 绘制准确函数图像
hold on
px = -5 : 1 : 5; % 插值点
py = sin(px); % 插值点上的函数值
plot(px,py,'m+') % 绘制插值点
[Ln] = SF_Lagrange(px,py); % 根据插值点及其值计算 Lagrange 插值多项式
Lx = -5:0.01:5; % 绘图点
Ly = polyval(Ln,Lx); % 计算绘图点上的多项式函数值
plot(Lx,Ly,'b-.') % 绘制 多项式 图像legend('sin(x)','point','Ln','Location','NorthEast')
hold off
求其中的函数[Ln] = SF_Lagrange(px,py);代码
就是因为没有定义[Ln] = SF_Lagrange(px,py)所以不能运行啊。。。
利用matlab实现Lagrange 插值多项式主程序为:function SF_Sinx = -5 : 0.01 : 5; y = sin(x); plot(x,y,'r:') % 绘制准确函数图像hold onpx = -5 : 1 : 5; % 插值点py = sin(px
我看看我有没有,好像我有一个拉格朗日插值法的程序
function h = hlagr2(L,x)
% HLAGR2
% MATLAB m-file for fractional delay approximation
%拉格朗日插值法的实现函数
% by LAGRANGE INTERPOLATION method
% h = hlagr2(L,x) returns a length L (real) FIR
% filter which approximates the fractional delay
% of x samples.
% Input: L = filter length (filter order N = L-1)
% x = fractional delay (0 < x