Plotting discontinuos X Data
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Moiz
le 2 Jan 2016
Réponse apportée : Mike Garrity
le 4 Jan 2016
I have a data set that looks like this :
datax = [6 7 8 9 14 48 49 50 55 87 88 89];
datay = [1 1 1 1 2 3 3 3 4 5 5 5];
I want to make a single figure which will have essentially 5 lines corresponding to every jump in the x data. The first line will be ones reperesenting X index 1:4 i.e, 6,7,8,9 The second line will be a single point at 2 representing X index 5 i.e, 14 The third line will be threes representing X index 6:8 i.,e 48,49,50 and so on. Also the code should be extendable to any datax with discontinuities like shown above and produce a new line at every discontinuity.
0 commentaires
Réponse acceptée
Mike Garrity
le 4 Jan 2016
datax = [6 7 8 9 nan 14 nan 48 49 50 55 nan 87 88 89];
datay = [1 1 1 1 nan 2 nan 3 3 3 4 nan 5 5 5];
plot(datax,datay,'-o')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!