how can I plot this figures

1 view (last 30 days)
Abdelkader Hd
Abdelkader Hd on 7 Aug 2022
Commented: Abdelkader Hd on 8 Aug 2022
Hi community,
Please I need your help to plot the figures like in the picture below.
Thanks
  2 Comments
Abdelkader Hd
Abdelkader Hd on 8 Aug 2022
@Sam Chak Thanks for your time, for example I have F is a function of x and y (F(x,y)). I need just the code used on matlab to plot a density

Sign in to comment.

Accepted Answer

M.B
M.B on 8 Aug 2022
Try the function contourf:
x = linspace(-2*pi,2*pi);
y = linspace(0,4*pi);
[X,Y] = meshgrid(x,y);
Z = sin(X) + cos(Y);
figure(101);
contourf(X,Y,Z,100, 'edgecolor','none');
colormap hot; % use colormapeditor for a customised colormap
  1 Comment
Abdelkader Hd
Abdelkader Hd on 8 Aug 2022
@M.B thank you sir for your help

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 8 Aug 2022
https://www.mathworks.com/help/matlab/ref/histcounts2.html can be used to calculate the counts for density plot purposes. imagesc() with the appropriate colormap and colorbar(). Use tiledlayout to arrange the plots.

Tags

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!