No BSD License  

Highlights from
Generate AR1 spatial data

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 4.46 KB File ID: #5099
image thumbnail

Generate AR1 spatial data

by Jon Yearsley

 

04 Jun 2004 (Updated 08 Jun 2004)

Generates spatial data using an AR1 process with normal error distribution.

| Watch this File

File Information
Description

This script generates artificial spatial data using a first order spatial autoregressive process (AR1)

The process is
X(i,j) = PHI*(X(i,j-1)+X(i,j+1)+X(i-1,j)+X(i+1,j) + error

To generate a 10x10, periodic spatial pattern, with normal error distribution, and a variance of SIGMA, the command is

spatialPatternAR1([10,10],PHI,SIGMA)

or equivalently,
spatialPatternAR1([10,10],PHI,SIGMA,1)

the same pattern, but with a rigid boundary is generated with

spatialPatternAR1([10,10],PHI,SIGMA,0)

Different error distributions can be used. Using the current script this can be done by extracting the generator matrix, M

M = spatialPatternAR1([10,10],PHI,SIGMA,1,1)

M is a 100x100 matrix.
Then given a random vector, error (size = 100x1) with indepedent elements sampled from the required error distribution, the spatial pattern is given by

x = reshape(M * error,[10,10])

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
statistics Jon Yearsley 22 Oct 2008 07:21:57
probability Jon Yearsley 22 Oct 2008 07:21:57
ar1 Jon Yearsley 22 Oct 2008 07:21:57
spatial data Jon Yearsley 22 Oct 2008 07:21:57
autoregressive Jon Yearsley 22 Oct 2008 07:21:57

Contact us at files@mathworks.com