% function generate_F_Gauss mean_a = mean amplitude sigma_a = standard deviation of signal bandwidth = effective bandwidth of signal K -> K^2 number of samples for generating complex amplitudes u = KxKmatrix of frequencies F = KxK complex Matrix of amplitudes (random phase) wf 3/2020
0001 %% function generate_F_Gauss 0002 % 0003 % mean_a = mean amplitude 0004 % sigma_a = standard deviation of signal 0005 % bandwidth = effective bandwidth of signal 0006 % K -> K^2 number of samples for generating complex amplitudes 0007 % 0008 % u = KxKmatrix of frequencies 0009 % F = KxK complex Matrix of amplitudes (random phase) 0010 % 0011 % wf 3/2020 0012 0013 function [u,F] = generate_F_Gauss_2D(mean_a,sigma_a,bandwidth,K) 0014 0015 % provide arrays 0016 u = zeros(K,2); 0017 F = zeros(K,1); 0018 % random frequencies in Gaussian with sigma = bandwidth 0019 u = rand_gauss([0,0]',bandwidth^2*eye(2),K)'; 0020 % zero frequency 0021 u(1,:) = [0,0]; 0022 % complex amplitude 0023 F = normpdf(u(:,1),0,bandwidth).*normpdf(u(:,2),0,bandwidth).*exp(1i*2*pi*rand(K,1)); 0024 F(1)=0; 0025 % normalize 0026 F = F/norm(F)*sigma_a*sqrt(2); 0027 % set mean 0028 F(1) = mean_a; 0029 return 0030