实验5插值实验

(1)Write a MATLAB function to perform the Lagrangian form Interpolation.function y=eg1_1x=[46,49,51,

09 年级、专业级信息与计算科学姓名学号名单序号 2011121Matlab 实验时间年月日版本 注:实验报告的最后一部分是实验小结与收获 实验报告(5):插值实验(Interpolation) 1. (1)WriteaMATLABfunctiontoperformtheLagrangianformInterpolation. y=eg1_1 function x=[46,49,51,52,54,56,57,58,59,60,61,62,63,64,66,67,68,71,72,71]; y=[40,50,55,63,72,70,77,73,90,93,96,88,99,110,113,120,127,137,132,137]; p=polyfit(x,y,3) xi=46:0.5:72; yi=polyval(p,xi) (2)Writeacallbackm-filetocheckthefunctionyouwrite. p= -0.00170.3275-16.9037291.3741 ans= Columns1through15 40505563727077739093968899110113 Columns16through20 120127137132137 2. Inthefollowingtable (savedinthedatafilenamed),XistheFahrenheittemperature, Interpolation_Problem1_data.xls (华氏的) andYisthenumberoftimesacricketchirpsinoneminute. (蟋蟀)(鸣叫) (1) Makeascatterplot()ofthedata. 散点图 >>x=[46,49,51,52,54,56,57,58,59,60,61,62,63,64,66,67,68,71,72,71]; >>y=[40,50,55,63,72,70,77,73,90,93,96,88,99,110,113,120,127,137,132,137]; >>plot(x,y,'o') >>grid 2011 秋数学实验基础 5Page1of 实验报告() 3

腾讯文库实验5插值实验