MATLAB 求 年降水 和 年均温

PRE
days = [365 365 365 366 365 365 365 366 365 365 365 366 365 365 365 366 365 365 365 366 365];
p = [];
n = 1;
m = 0;
for i = 1:length(days)
	// 求每一年的首尾边界
	if i >=2
		n = n + days(i);
	end
	m = m + days(i);
	
	//按列累加
	t = sum(PRE(n:m,:));
	//接到数组后面
	p = [p;t];

end

//输出成xls
xlswrite('E:\pre.xlsx',p);


TEMmax
TEMmin
days = [365 365 365 366 365 365 365 366 365 365 365 366 365 365 365 366 365 365 365 366 365];
tem = [];
n = 1;
m = 0;
for i = 1:length(days)
	if i >=2
		n = n + days(i);
	end
	m = m + days(i);
	
	//求日均温
	t_a = [];
	for j = n:m
		a = (TEMmax(j,:)+TEMmin(j,:))/2;
		t_a = [t_a;a];
	end
	
	t = mean(t_a,1);
	tem = [tem;t];

end

你可能感兴趣的:(其他)