clipboard.png

1、多元函数模型rstool

clipboard.png

x1=[1000 600 1200 500 300 400 1300 1100 1300 300];%收入
x2=[5 7 6 6 8 7 5 4 3 9];%价格
y=[100 75 80 70 50 65 90 100 110 60]';%需求量
x=[x1' x2'];
rstool(x,y,'purequadratic')

clipboard.png

clipboard.png

2、其它多项式类拟合cftool

拟合模式:
clipboard.png

clipboard.png
结果判断

clipboard.png

clipboard.png

3、matalb插值并画图


3.1.一维插值

clipboard.png

clipboard.png

hours=1:12;
temps=[5 8 9 15 25 29 31 30 22 25 27 24];
h=1:0.1:12;
t=interp1(hours,temps,h,'spline');
plot(hours,temps,'+',h,t,hours,temps,'r:') 
xlabel('Hour'),ylabel('Degrees Celsius')

3.2二维插值(空间上)

clipboard.png

clipboard.png

x=1:5;
y=1:3;
temps=[82 81 80 82 84;79 63 61 65 81;84 84 82 85 86];
mesh(x,y,temps)

clipboard.png

xi=1:0.2:5;
yi=1:0.2:3;
zi=interp2(x,y,temps,xi',yi,'cubic');
mesh(xi,yi,zi)
contour3(xi,yi,zi,[75,75],'r')%空间75等高线图

图片描述

clipboard.png


叫我瞄大人
467 声望81 粉丝

喜欢追星的非科班的编程爱好者


引用和评论

0 条评论