Smoothing two Histogram on the same figure for an article

6 views (last 30 days)
Hi friends,
I'm starting using matlab for my thesis.
I have two vectors [x] and [y].
I want them to be displayed as the attached image.
thanks :)
  2 Comments
Roger J
Roger J on 20 Jul 2020
At the command prompt type F1, then click "Open Help Browser" link.
In the help browser on the top right, type "plot" into the Search Documentation box.
"plot - 2-D line plot" is what you are looking for.
Select that, and scroll down to "Plot Multiple Lines" section.
t = linspace(-.5,.5, numel(x)) % this will be the horizontal axis in your picture
figure
plot(t,x,t,y) % this will plot x and y vs. t, and assumes x&y have the same number of elements
You will also find on that page, how to add labels to the axis, and how to add a legend.
noa goldman
noa goldman on 20 Jul 2020
thanks but i need as hist shape. as the pic i added.

Sign in to comment.

Answers (0)

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!