How to replicate this graph with random peaks?

I need help replicating this graph that is perfect for the project I am working on right now.
One characteristic that is especially difficult for me to grasp is the continuous surface the peaks are attached to. Is there an equation or function that can get me to this point?
Edit: Changing the sign of Z in the peaks function seems to have done the job. However, I'd like to make it so that I can change the location and amplitude of these peaks. Is there a way I can modify the peaks function equation to do so?
I'm not exactly sure how to do this, so any advice is much appreciated. Thank you!

답변 (1개)

Mathieu NOE
Mathieu NOE 2022년 5월 30일

0 개 추천

hello
see little demo below , based on random data (up to you to specify x, y centers , sigmas and z amplitudes )
here I generated 10 peaks with random positions , sigmas and peak amplitude
% dummy random data
x = (0:1:100);
y = (0:1:100);
xc = max(x)*rand(10,1); % x center
yc = max(y)*rand(10,1); % y center
sigmax = 2+7*rand(10,1); % x sigma
sigmay = 3+5*rand(10,1); % y sigma
A = rand(10,1); % peak amplitude
nb_peaks = numel(xc);
[xx,yy] = meshgrid(x,y);
z = 0;
for ck = 1:nb_peaks
z = z + A(ck)*exp(-(xx-xc(ck)).^2/(2*sigmax(ck)^2)-(yy-yc(ck)).^2/(2*sigmay(ck)^2));
end
surf(xx,yy,z);
colorbar

댓글 수: 2

Thanks Mathieu, you saved my problem, I have been looking for such a surface generating code with mulitple peaks for a while...
hello
glad I could be of some help

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 5월 27일

댓글:

2022년 5월 31일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by