0001
0002
0003
0004
0005
0006
0007
0008 close all
0009 clearvars
0010
0011 addpath(genpath('../../General-Functions'));
0012
0013
0014 NoSample = 3;
0015 N = 300;
0016
0017
0018 d0 = 20;
0019 sigma = 1;
0020
0021
0022 d0l = 10;
0023 sigma_l = 0.5;
0024 d0r = 40;
0025 sigma_r = 3;
0026 dc = 30;
0027
0028
0029
0030
0031
0032 col=['k','b','r','c','m'];
0033 lin=['-','-','-','-','-'];
0034
0035
0036
0037 ss = plot_init;
0038
0039
0040
0041
0042
0043 Sigma=zeros(N);
0044
0045 for n=1:N/2
0046 for m=1:N/2
0047 d=(n-m)/d0l;
0048
0049 sig = (sigma_r+(sigma_l-sigma_r)./(1+exp(-(n-N/2)./N.*dc)))*...
0050 (sigma_r+(sigma_l-sigma_r)./(1+exp(-(m-N/2)./N.*dc)));
0051 Sigma(n,m)=sig*exp(-d^2/2);
0052 end
0053 end
0054
0055 for n=N/2+1:N
0056 for m=N/2+1:N
0057 d=(n-m)/d0r;
0058
0059 sig = (sigma_r+(sigma_l-sigma_r)./(1+exp(-(n-N/2)./N.*dc)))*...
0060 (sigma_r+(sigma_l-sigma_r)./(1+exp(-(m-N/2)./N.*dc)));
0061 Sigma(n,m)=sig*exp(-d^2/2);
0062 end
0063 end
0064
0065 for n=1:N/2
0066 for m=N/2+1:N
0067
0068 d=abs(N/2+1/2-n)/d0l + abs(m-N/2-1/2)/d0r;
0069
0070 sig = (sigma_r+(sigma_l-sigma_r)./(1+exp(-(n-N/2)./N.*dc)))*...
0071 (sigma_r+(sigma_l-sigma_r)./(1+exp(-(m-N/2)./N.*dc)));
0072 Sigma(n,m) = sig*exp(-d^2/2);
0073
0074 Sigma(m,n) = Sigma(n,m);
0075 end
0076 end
0077
0078
0079 y = rand_gauss(zeros(N,1),Sigma,NoSample);
0080
0081
0082 rang = N:-1:1;
0083 figure('name','inhomogeneous GP','color','w','Position',[0.55*ss(1),0.2*ss(2),0.35*ss(1),0.60*ss(2)]);hold on
0084
0085 for s = 1:NoSample
0086 plot(1:N,y(rang,s)'+...
0087 3*(sigma_r+...
0088 (sigma_l-sigma_r)./(1+exp(-(rang-N/2)./N*dc))),...
0089 strcat(lin(s),col(s)),'LineWidth',3);
0090 end
0091 xlabel('$x$');ylabel('$z$')
0092 title('Fig. 16.11: Samples of inhomogeneous profiles')