Azzera filtri
Azzera filtri

how do i plot date in x axis

1 visualizzazione (ultimi 30 giorni)
Mitson Monteiro
Mitson Monteiro il 6 Giu 2013
i have delta t date on a daily baisis starting from 17nov 2007 to 31march2008 how to plot the data with month and year on the x axis

Risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 6 Giu 2013
dat=datenum('17/11/2007','dd/mm/yyyy'):datenum('11/03/2008','dd/mm/yyyy');
y=cos(0.1*(1:numel(dat))); % Example
plot(dat,y)
datic=unique(datestr(dat,'mm-yyyy'),'rows')
xt=get(gca,'xtick')
xt1=linspace(min(xt), max(xt),size(datic,1))
set(gca,'xtick',xt1)
set(gca,'xticklabel',datic)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by