Divide data in parts and plot them on a vertical line

2 次查看(过去 30 天)
Hello!
I have a matrix that stores my probability, number of data analyzed and time (time and #samples are related, every single data is sampled at 0.033 seconds, so 3.3 for 100); it looks like:
0.873615503511876 100 3.30000000000000
0.902974727374816 100 3.30000000000000
0.900676294700403 100 3.30000000000000
0.936103354207504 200 6.60000000000000
0.897578193607001 200 6.60000000000000
0.944744655111605 200 6.60000000000000
0.972746082496182 300 9.90000000000000
0.940582356717829 300 9.90000000000000
0.977908283040241 300 9.90000000000000
0.962956328635856 400 13.2000000000000
0.968370651998859 400 13.2000000000000
0.980665507251175 400 13.2000000000000
I want to have a 2D plot with probability values on y axis and time on x axis, where all datas recorded at the same time are allineated vertically. In this way I should get a plot at the end where on x I have 3.3, 6.6, 9.9, 13.2 and for every one of these 3 point on y axis.
Can someone help me do that? Thanks!

回答(1 个)

Scott MacKenzie
Scott MacKenzie 2022-2-24
From your description, this seems to work:
M = [
0.873615503511876 100 3.3;
0.902974727374816 100 3.3;
0.900676294700403 100 3.3;
0.936103354207504 200 6.6;
0.897578193607001 200 6.6;
0.944744655111605 200 6.6;
0.972746082496182 300 9.9;
0.940582356717829 300 9.9;
0.977908283040241 300 9.9;
0.962956328635856 400 13.2;
0.968370651998859 400 13.2;
0.980665507251175 400 13.2];
scatter(M(:,3), M(:,1), 'filled');
xlabel('Time');
ylabel('Probability');

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by