龙格现象实验报告1
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
数值分析实验报告
实验名称:观察龙格(Runge)现象实验
班级:12级信息与计算科学(1)班
姓名:
学号:33 16 17 59
实验日期: 2014.10.11 周次: 6 实验地点: A14-504
多种插值对比
function y=fun(x); y=5./(1+x.^2); end
hours=-5:5; h=-5:0.1:5; temps=fun(hours);
t1=interp1(hours,temps,h,'spline'); %(Ö±½ÓÊä³öÊý¾Ý½«ÊǺܶàµÄ) t2=interp1(hours,temps,h, 'nearest'); t3=interp1(hours,temps,h, 'linear'); t4=interp1(hours,temps,h, 'cubic');
subplot(2,2,1); plot(hours,temps, ' bo',h,t1, 'r'); title('spline '); %×÷ͼ
subplot(2,2,2); plot(hours,temps, 'bo',h,t2, 'r'); title(' nearest'); subplot(2,2,3); plot(hours,temps, 'bo',h,t3, 'r'); title('linear'); subplot(2,2,4); plot(hours,temps, 'bo',h,t4, 'r', h,t1, 'g'); title('cubic-spline');
-5
05
spline
-5
05
nearest
-5
05
linear
-5
05
cubic-spline