How to plot data against samples

14 vues (au cours des 30 derniers jours)
will99
will99 le 9 Oct 2015
Commenté : Star Strider le 9 Oct 2015
let say I have sample 1000 and myData = rand(1,samples) how can I plot myData against samples do I tried
figure
plot(myData);
and
figure
plot(sample);
but I got nothing show on my window

Réponses (1)

Star Strider
Star Strider le 9 Oct 2015
See if this does what you want:
figure(1)
plot(myData)
hold on
plot(sample)
hold off
  2 commentaires
will99
will99 le 9 Oct 2015
it didn't work I only got think straight line on the x-axis
Star Strider
Star Strider le 9 Oct 2015
It actually did work. Your ‘sample’ is a single data point plotted at (0,1000). Your ‘myData’ vector are a sequence of random floating-point numbers on the interval (0,1). The plot scales them linearly in both axes, so the random vector appears as a line on the x-axis.
To see this, plot them logarithmically:
sample = 1000;
myData = rand(1,sample);
figure(1)
semilogy(myData, '-r')
hold on
plot(sample, 'bp')
hold off

Connectez-vous pour commenter.

Catégories

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

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by