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

📄 demogasnewt.m

📁 这是《Numerical Methods with MATLAB: Implementation and Application》一书的配书程序(Matlab)
💻 M
字号:
function demoGasNewt
% demoGasNewt  Interpolate gasoline price data with Newton polynomials
%
% Synopsis:  demoGasNewt
%
% Input:     none
%
% Output:    Plot of given data and interpolating function for gas price

year =  [1986   1988   1990   1992   1994   1996 ]';    %  input data
price = [133.5  132.2  138.7  141.5  137.6  144.2]';

% --- Interpolate and plot results
y = linspace(min(year),max(year),200);  %  eval interpolant at these dates
p = newtint(year,price,y);
plot(year,price,'o',y,p,'-');
xlabel('year');  ylabel('gasoline price, (cents)');

⌨️ 快捷键说明

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