⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gmp1.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                                gmp1.m
%  Scope:   This MATLAB macro generates first order Gauss-Markov sequence.
%  Usage:   x = gmp1(nstep,beta,sigx,deltat,iseed)
%           x = gmp1(nstep,beta,sigx,deltat)      when the seed is not reset
%  Description of parameters:
%           nstep  - input, number of steps of the Gauss-Markov process
%           beta   - input, parameter of the Gauss-Markov process, 1/beta is
%                    the correlation time in seconds
%           sigx   - input, standard deviation of the Gauss-Markov process  x
%           deltat - input, time step in seconds
%           iseed  - input, initial value of the seed (optional); if it is
%                    specified the seed is reset to iseed value
%           x      - output, computed value of the Gauss-Markov process x,
%                    vector with nstep elements
%  External Matlab macros used:  genrn
%  Method: 
%           Direct implementation of the formula
%              x_new = exp(-beta*delta) * x_old + w
%           where
%              w  is a normally distributed random number with zero mean 
%                 and standard deviation equals to 
%                 sigma_x * sqrt(1 - exp(-2*beta*delta))
%  Last update:  01/07/01
%  Copyright (C) 1996-98 by LL Consulting. All Rights Reserved.

function  x = gmp1(nstep,beta,sigx,deltat,iseed)

if ( (nargin < 4) | (nargin > 5) )
   disp('Error - GMP1.m  - check the argument list');
   disp('  ');
   return
elseif  (nargin == 5)
   rand('seed',iseed);  
end

clear x
x = zeros(nstep,1);

for k = 1:nstep
   if k == 1
      temp =  1.0 - exp(-2.0 * beta * deltat);
      stdevw = sigx * sqrt(temp);
      expbdt = exp(-beta * deltat);
      xk = 0.;
   end
   x(k) = expbdt * xk + genrn(1,0.,stdevw);
   xk = x(k);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -