How to plot data against samples
이전 댓글 표시
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
답변 (1개)
Star Strider
2015년 10월 9일
See if this does what you want:
figure(1)
plot(myData)
hold on
plot(sample)
hold off
댓글 수: 2
will99
2015년 10월 9일
Star Strider
2015년 10월 9일
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
카테고리
도움말 센터 및 File Exchange에서 Exploration and Visualization에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!