最小二乘法实例应用

本文通过实例展示了如何使用最小二乘法分析不同海域的海表面温度变化趋势,包括阿拉伯海区、孟加拉湾、东印度洋暖池区、西印度洋暖池区和索马里沿岸区的数据。每个区域的R²值和斜率(K)也被详细计算并标注在图表上,提供了直观的线性趋势理解。
摘要由CSDN通过智能技术生成

最小二乘法实例应用
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

程序


%% 调用颜色;
cmap=colormore_17(2:6);line=1.8;line2=1.5;
num=17
% 画图
figure;
h1=plot(sst_alab,'-o','linewidth',line,...
    'color',cmap(1,:),'MarkerFaceColor',cmap(1,:));%净热通量
hold on
plt_h=fplot(alab_yy);
set(plt_h,'color',cmap(1,:),'linewidth',line2)
hold on
h2=plot(sst_bob,'-o','linewidth',line,...
    'color',cmap(2,:),'MarkerFaceColor',cmap(2,:));%净热通量
hold on
plt_h=fplot(bob_yy);
set(plt_h,'color',cmap(2,:),'linewidth',line2)
hold on
h3=plot(sst_east,'-o','linewidth',line,...
    'color',cmap(3,:),'MarkerFaceColor',cmap(3,:));%净热通量
hold on
plt_h=fplot(east_yy);
set(plt_h,'color',cmap(3,:),'linewidth',line2)
hold on
h4=plot(sst_west,'-o','linewidth',line,...
    'color',cmap(4,:),'MarkerFaceColor',cmap(4,:));%净热通量
hold on
plt_h=fplot(west_yy);
set(plt_h,'color',cmap(4,:),'linewidth',line2)
hold on
h5=plot(sst_sumali,'-o','linewidth',line,...
    'color',cmap(5,:),'MarkerFaceColor',cmap(5,:));%净热通量
hold on
plt_h=fplot(sumali_yy);
set(plt_h,'color',cmap(5,:),'linewidth',line2)
hold on
axis([1 40 23 31]);
leg_h=legend([h1,h2,h3,h4,h5],'阿拉伯海区','孟加拉湾区','东印度洋暖池区','西印度洋暖池区','索马里沿岸区','orientation','horizontal');
set(leg_h,'position',[0.13 0.48 0.8 0.2],'fontsize',12,'fontname','宋体');
legend boxoff;
box off
title('自编最小二乘法线性趋势')
text(40.5,31,['K\_west=',num2str(round(west_c(2),2))])
text(40.5,30.5,['R^2\_west=',num2str(round(west_wucha,2))])
text(40.5,29.5,['K\_east=',num2str(round(east_c(2),2))])
text(40.5,29,['R^2\_east=',num2str(round(east_wucha,2))])
text(40.5,26.5,['K\_alab=',num2str(round(alab_c(2),2))])
text(40.5,26,['R^2\_alab=',num2str(round(alab_wucha,2))])
text(40.5,25.5,['K\_bob=',num2str(round(bob_c(2),2))])
text(40.5,25,['R^2\_bob=',num2str(round(bob_wucha,2))])
text(40.5,24.5,['K\_sumali=',num2str(round(sumali_c(2),2))])
text(40.5,24,['R^2\_sumali=',num2str(round(sumali_wucha,2))])
alpha(1)
set(gca,'fontsize',12,'fontweight','bold','xtick',[1:2:41],'xticklabel',[1979:2:2018],'fontname','time news roman');
xlabel(['\fontname{宋体}时间(年)', sprintf('\n'),'\fontname{Times New Roman}time( year )'],'fontsize',15,'fontweight','bold');
ylabel(['\fontname{宋体}海表面温度', sprintf('\n'),'\fontname{Times New Roman}sea surface temperature( °C)'],'fontsize',15,'fontweight','bold');
set(gcf,'position',[50,50,1100,500],'color','w');
export_fig(['自编最小二乘法线性趋势',num2str(num),'.png'],'-r300')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海洋与大气科学

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值