Réponse acceptée

Aravind Ravikumar
Aravind Ravikumar le 19 Juin 2019

0 votes

What you are looking for is 2-D Bar Graph. You can add legends using legend.

3 commentaires

Mallouli Marwa
Mallouli Marwa le 19 Juin 2019
How can I add x values (20Hz, 30Hz, 40Hz) like in the attached figure
x = [3 4;1.5 1.75;0.25 0.3];
bar(x,'hist');
legend('PZT','MFC');
set(gca,'xticklabel',{'20Hz','30Hz','40Hz'});
This code will produce bar graph like the attached image. gca will select the current axes and then you could specify the xticklabel for the bar graph.
Mallouli Marwa
Mallouli Marwa le 19 Juin 2019
Thanks

Connectez-vous pour commenter.

Plus de réponses (1)

the cyclist
the cyclist le 18 Juin 2019

1 vote

Use the bar function.

3 commentaires

Mallouli Marwa
Mallouli Marwa le 19 Juin 2019
Modifié(e) : Mallouli Marwa le 19 Juin 2019
How can I add a legend in the corner of the curve like in the attached curve ?
the cyclist
the cyclist le 19 Juin 2019
I suggest you take a look at the MATLAB Plot Gallery, which has examples of lots of plot types, along with the code that produces them. This may save you time asking about everything small addition that you want, one at a time.
Mallouli Marwa
Mallouli Marwa le 20 Juin 2019
Thanks

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by