generate_observed_AR2
PURPOSE
% generate_observed_AR2 with noise and ouliers
SYNOPSIS
function [x, y, out_in, select, xs, ys] =generate_observed_AR2(N, sigma_e, sigma_n, Pout, Mout, type_out, dens)
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
SOURCE CODE
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 function [x, y, out_in, select, xs, ys] = ...
0024 generate_observed_AR2(N, sigma_e, sigma_n, Pout, Mout, type_out, dens)
0025
0026
0027 x = zeros(N, 1);
0028 y = zeros(N, 1);
0029
0030
0031 for n = 3:N
0032 x(n) = 1.9998 * x(n - 1) - 0.9999 * x(n - 2) + randn(1) * sigma_e;
0033 y(n) = x(n) + randn(1) * sigma_n;
0034 end
0035
0036
0037 for i = 1:N
0038 y(i) = y(i) - (i - 1) * (x(N) - x(1)) / (N - 1);
0039 x(i) = x(i) - (i - 1) * (x(N) - x(1)) / (N - 1);
0040 end
0041
0042 out_in = zeros(N, 1);
0043 m = 0;
0044 for i = 1:N
0045
0046 if rand(1) < Pout
0047 out_in(i) = 1;
0048 if type_out == 0
0049 y(i) = y(i) + 2 * (rand(1) - 0.5) * Mout;
0050 else
0051 y(i) = y(i) + rand(1) * Mout;
0052 end
0053 end
0054
0055
0056 if rand(1) < dens
0057 m = m + 1;
0058 select(m) = i;
0059 xs(m) = x(i);
0060 ys(m) = y(i);
0061 end
0062 end
0063
0064
0065
Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005