I want to plot X & Y data for different Time step.
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Any one could help me> I am very new at matlab.
I'm trying to figure out a way to show in a scatter plot. I have excel and text file data file where at 900 sec I have 44 xy points, at 950 sec 234 points,....., at 1150 sec 260 points. How can I do that.
Example data:
# THIS IS A EXTINCTION PLOT FILE
# The Time Passed = 900
# The Volume Entered = 0.000156572
XPOS YPOS AF
0.22 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.21 0.105 0.00000D+00
0.205 0.105 0.00000D+00
0.205 0.105 0.00000D+00
0.14 0.095 0.00000D+00
0.135 0.095 0.00000D+00
....
....
0.23 0.095 0.00000D+00
0.23 0.1 0.00000D+00
0.225 0.105 0.00000D+00
0.22 0.105 0.00000D+00
# THIS IS A EXTINCTION PLOT FILE
# The Time Passed = 950
# The Volume Entered = 0.000156707
XPOS YPOS AF BF CF
0.22 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.215 0.105 0.00000D+00
0.21 0.105 0.00000D+00
0.205 0.105 0.00000D+00
....
0.23 0.075 0.00000D+00
0.23 0.08 0.00000D+00
0.23 0.08 0.00000D+00
0.23 0.085 0.00000D+00
0.23 0.09 0.00000D+00
0.23 0.09 0.00000D+00
0.23 0.095 0.00000D+00
0.23 0.1 0.00000D+00
0.225 0.105 0.00000D+00
0.22 0.105 0.00000D+00
0 comentarios
Respuesta aceptada
Geoff
el 1 de Abr. de 2012
How about this:
hold off;
scatter( x1, y1, 'bo' ); % Blue circles
hold on;
scatter( x2, y2, 'gv' ); % Green triangles
scatter( x3, y3, 'rs' ); % Red squares
hold off;
legend( '900 seconds', '950 seconds', '1150 seconds' );
The hold on command will cause new plots to be added to the existing figure.
0 comentarios
Más respuestas (3)
Tan Has
el 2 de Abr. de 2012
2 comentarios
Geoff
el 2 de Abr. de 2012
Does your data have a column of time values in it? The usual thing to do (let's say that column 4 has the time) is:
t = M(:,4);
x900 = xarray(t==900);
x950 = xarray(t==950);
... etc
Otherwise, if you really want to read different data lengths and you know the lengths already, don't use those formulae for 'm' and 'n'. Just do one read for each set. That is, hard-code the row and column into multiple calls to 'dlmread'.
Geoff
el 2 de Abr. de 2012
Sorry, I forgot you had given a sample data file. The easiest way for you to proceed will be to hard-code the numbers as in my second suggestion above.
Tan Has
el 2 de Abr. de 2012
1 comentario
Geoff
el 2 de Abr. de 2012
That's what 'hold on' does. It plots onto the same axes as the last plot. You have a lot of questions, and it is not helpful to post them here. Post a new question when you need to know something, so that other people can search for relevant answers if they want to do the same thing.
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!