Convolution of two Matrices without changing the density function.
조회 수: 7 (최근 30일)
이전 댓글 표시
I was working with a code to generate a 2D-surface. My goal is to create a surface where the density function (height distribution) looks like the one produced by the following code:
N=1000; %Number of Points
m = [-0.3; 1.3]; %Means
sigma = cat(3,0.5,0.04); %Standard deviation
w = [5; 1]; %Weights for the two means
gmd = gmdistribution(m,sigma,w); %Gaussian mixture model
vec = random(gmd,N^2); %Draw random numbers from gmd
Z = reshape(vec,[N,N]); %Reshape vec into a Matrix
Plotting the histogram of Z shows a Gaussian distribution with two peaks (bimodal gaussian distribution). Now I want to convolute this set of numbers Z to get a 2D-surface with correlating points:
rL=60; %Surface Length
clx=0.4; %Correlation length
x = linspace(-rL/2,rL/2,N); %Create x-Coordinate Vector
y = linspace(-rL/2,rL/2,N); %Create y-Coordinate Vector
[X,Y] = meshgrid(x,y); %Create Coordinate System
F = exp(-((X.^2+Y.^2)/(clx^2/2))); %Gaussian filter
f = 2/sqrt(pi)*rL/N/clx*ifft2(fft2(Z).*fft2(F)); %Correlation of surface including convolution, inverse Fourier transform and normalizing prefactors
Now here is my problem: The density function of f looses the bimodal characteristics and has just one peak. I would like to know if there is a way to keep this bimodal characteristics, or is it impossible because of how the convolution and the fourier transformations work? Could I solve this problem by changing the filter F? Or does anyone know an alternative method?
Thanks in advance,
David
(As orientation I used the code from the Random surface generator from this website: http://www.mysimlabs.com/surface_generation.html )
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!