Tuesday, August 23, 2016

Matlab: Gravity Model for Some Value

Gravity Center

某指数的空间重心可以由以下公式直接算出:
\[X = \frac{{\sum\limits_{i = 1}^n {{W_i}{X_i}} }}{{\sum\limits_{i = 1}^n {{W_i}} }}\] \[Y = \frac{{\sum\limits_{i = 1}^n {{W_i}{Y_i}} }}{{\sum\limits_{i = 1}^n {{W_i}} }}\]
式中:X、Y为重心的经度(横坐标)、纬度(纵坐标);W为某指数;n为参与计算的指数数量。

Movement Distance

重心转移距离可以由以下公式直接算出:
\[D = \sqrt {{{\left( {{X_{t1}} - {X_{t2}}} \right)}^2} + {{\left( {{Y_{t1}} - {Y_{t2}}} \right)}^2}} \]
式中:D为重心转移距离;t1、t2为前后两个时间。

References

[1] Yingbin He, Youqi Chen, Huajun Tang, et al.. Exploring spatial change and gravity center movement for ecosystem services value using a spatially explicit ecosystem services value index and gravity model[J]. Environmental Monitoring and Assessment, 2011, 175:563–571.
[2] Caiyao Xu, Lijie Pu, Ming Zhu, et all.. Ecological Security and Ecosystem Services in Response to Land Use Change in the Coastal Area of Jiangsu, China[J]. Sustainability, 2016, 8(8): 1~24.
[3] 孙东琪, 张京祥, 朱传耿等. 中国生态环境质量变化态势及其空间分异分析[J]. 地理学报, 2012, 67(12): 1599~1610.

Tuesday, August 16, 2016

Matlab: Nested Functions

What Are Nested Functions?

A nested function is a function that is completely contained within a parent function. Any function in a program file can include a nested function.
For example, this function named parent contains a nested function named nestedfx:
1
2
3
4
5
6
7
8
9
function parent
disp('This is the parent function')
nestedfx

   function nestedfx
      disp('This is the nested function')
   end

end
The primary difference between nested functions and other types of functions is that they can access and modify variables that are defined in their parent functions. As a result:
  1. Nested functions can use variables that are not explicitly passed as input arguments.
  2. In a parent function, you can create a handle to a nested function that contains the data necessary to run the nested function.

References

Monday, August 15, 2016

Matlab: 拉伸渲染

Introduction

拉伸渲染单波段图片,需注意拉伸范围包括背景。为消除背景对拉伸范围的影响,只需将背景数值设置为有效区域数值即可,不大于最大值且不小于最小值,mask文件最终将会为背景赋上其它颜色。
拉伸颜色采自cbrewer,序列使用短名称:seq、div、qual,具体色带如Fig. 1。
Fig. 1
示例文件拉伸效果如Fig. 2,包含空间信息。
Fig. 2

References

Matlab: 图片背景扩大

Introduction

原图片置于更大背景。
Fig. 1

Sunday, July 17, 2016

Matlab: 统计面积

Introduction

以地理编码统计图上类型的面积,结果是平方公里km2。
XLS的sheet名称表示大类,内容是大类包含子类型的编码,其结果就是按照大类输出表示。按照需求调整sheet名称及地理编码即可得到所需类型的面积。
Fig. 1

Sunday, July 10, 2016

Matlab: Enhanded Embedded Images

Introduction

图片上再镶嵌图片的加强版。

Code Specification

1
2
3
4
5
6
propset.edgecolor=[255, 255, 255];
propset.edgepixs=5;
propset.scale4img=0.8;
propset.xscale=0.01; % scale of the background width
propset.yscale=0.01; % scale of the background height
propset.col=2;
从上至下依次指定:边框颜色、边框宽度(像元)、镶嵌图片的缩放比例、镶嵌位置X和Y(注意设置,若该位置镶嵌图片大于背景图片范围,程序出错)、指定镶嵌列数。 镶嵌示例如Fig. 1。