Effacer les filtres
Effacer les filtres

How do I make such plot using axis command?

1 vue (au cours des 30 derniers jours)
Altin Guberi
Altin Guberi le 19 Juin 2015
Commenté : Azzi Abdelmalek le 19 Juin 2015
Hello . Okay so the x values are x=0:0.5:2 , while y=10:10:30 . Now I want to know if there is any way to make a plot using axis command which shows these on x axis 0 0.5000 1.0000 1.5000 2.0000 and these on y axis 10 20 30 . Thank you and have a nice day!!

Réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 19 Juin 2015
Modifié(e) : Azzi Abdelmalek le 19 Juin 2015
x=0:0.5:2 ,
y=10:10:30
plot(y)
h=gca
xt=get(h,'xtick')
set(h,'xtick',linspace(xt(1),xt(end),numel(x)))
set(h,'xticklabel',arrayfun(@num2str,x,'un',0))
  2 commentaires
Altin Guberi
Altin Guberi le 19 Juin 2015
no , I want it the y axis to appear only 10 20 30 . Can you make this?
Azzi Abdelmalek
Azzi Abdelmalek le 19 Juin 2015
Ok:
x=0:0.5:2 ,
y=10:10:30
plot(y)
h=gca
xt=get(h,'xtick')
set(h,'xtick',linspace(xt(1),xt(end),3))
x1=[10 20 30];
set(h,'xticklabel',arrayfun(@num2str,x1,'un',0))

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by