i have several sets of data. each set list of numbers distance 0 particle has travelled. each set associated finite time, set 1 distances @ t=0; set 2 distances @ t=1 , on. size of each set total number of particles , size of each set same.
i want plot concentration vs distance line.
for example, if there 1000 particles (the size of sets); @ time t=0 plot straight line x=0 because particles @ 0 (the set contains 1000 zeroes). concentration @ x=0 =100% , 0% @ other distances
at t=1 , t=2 , on, distances increase (generally) might have sets this: (just example)
t1 = (1.1,2.2,3.0,1.2,3.2,2.3,1.4...) etc t2 = (2.9,3.2,2.6,4.5,4.3,1.4,5.8...) etc
it each number in each set unique in set
the aim have several plots (i can plot them on 1 graph) show concentration on y-axis , distance on x-axis. imagine t increases t0, t1, t2 plot flatten until concentration same everywhere.
the x-axis (distance) has fixed maximum same each plot. so, example, sets have curve hits 0 on y-axis (concentration) @ low value x (distance) time increases, envisage flat line line not cross x-axis (concentration non-zero everywhere)
i have tried histogram, not giving results want. line plot have try , put distances common-sense sized bins.
thank w
some rough data
y1 = 1.0e-09 * [0.3358, 0.3316, 0.3312, 0.3223, 0.2888, 0.2789, 0.2702,... 0.2114, 0.1919, 0.1743, 0.1738, 0.1702, 0.0599, 0.0003, 0, 0, 0, 0, 0, 0]; y2 = 1.0e-08 * [0.4566, 0.4130, 0.3439, 0.3160, 0.3138, 0.2507, 0.2483,... 0.1714, 0.1371, 0.1039, 0.0918, 0.0636, 0.0502, 0.0399, 0.0350, 0.0182,... 0.0010, 0, 0, 0]; y3 = 1.0e-07 * [0.2698, 0.2671, 0.2358, 0.2250, 0.2232, 0.1836, 0.1784,... 0.1690, 0.1616, 0.1567, 0.1104, 0.0949, 0.0834, 0.0798, 0.0479, 0.0296,... 0.0197, 0.0188, 0.0173, 0.0029];
these data sets contain distances of 20 particles. y0
set zeros. dealing thousands, data sets large.
thankyou
well, basically, miss hold
command. first, put data in 1 matrix, this:
y = [1.0e-09 * [0.3358, 0.3316, 0.3312, 0.3223, 0.2888, 0.2789, 0.2702,... 0.2114, 0.1919, 0.1743, 0.1738, 0.1702, 0.0599, 0.0003, 0, 0, 0, 0, 0, 0]; 1.0e-08 * [0.4566, 0.4130, 0.3439, 0.3160, 0.3138, 0.2507, 0.2483,... 0.1714, 0.1371, 0.1039, 0.0918, 0.0636, 0.0502, 0.0399, 0.0350, 0.0182,... 0.0010, 0, 0, 0]; 1.0e-07 * [0.2698, 0.2671, 0.2358, 0.2250, 0.2232, 0.1836, 0.1784,... 0.1690, 0.1616, 0.1567, 0.1104, 0.0949, 0.0834, 0.0798, 0.0479, 0.0296,... 0.0197, 0.0188, 0.0173, 0.0029]];
then need plot each time step separately, , use hold on
paste them on same axes:
hold on r = size(y,1):-1:1 histogram(y(r,:)); end hold off t_names = [repmat('t',size(y,1),1) num2str((size(y,1):-1:1).')]; legend(t_names)
which give (using example data):
notice, in loop iterate on rows backwards - that's make narrower histograms plot on wider, can see of them clearly.
edit
in case want continues lines, , not bins, have first histogram values histcounts
, plot them line:
hold on r = 1:size(y,1) [h,e] = histcounts(y(r,:)); plot(e,[h(1) h]) end hold off t_names = [repmat('t',size(y,1),1) num2str((1:size(y,1)).')]; legend(t_names)
Comments
Post a Comment