Plot a huge data in Matlab

60 visualizaciones (últimos 30 días)
sally_wu
sally_wu el 14 de Oct. de 2015
Editada: Kirby Fears el 14 de Oct. de 2015
I am trying to plot a cdf with the following data. I have a huge data with one column and total numbers are 116100 i.e. 116100x1 double. A minimum=0, maximum=1734719, average=1022, and standard deviation=16312. Every my attempt to plot the ecdf is crushed and shows just a straight line instead of showing a curve (cdf). I think Matlab cannot handle such big data.

Respuestas (1)

Kirby Fears
Kirby Fears el 14 de Oct. de 2015
Matlab can easily plot this data. Is each column of your 116100x4 double a separate variable that you want to plot?
Try plotting one column of Y values against whatever your X values are, e.g.
plot(X,Y(:,1));
Below is a simple example that plots a normal distribution with mu and sigma as you indicated.
X=(1:116100)';
Y=1022+16512*randn(size(X));
plot(X,Y);
This plot looks exactly as expected. Since there are so many X observations, the plot looks very compressed along the X axis. You could "zoom in" on a portion of the data to get a better view, as done below.
idx=1:100;
plot(X(idx),Y(idx));
Much more detail is visible when fewer points are observed. You could apply this approach to a 4-column Y matrix as well if you want to see all 4 variables at once on a subset of X values.
% to plot a subset of Y column 1
plot(X(idx),Y(idx,1));
% to plot a subset of all 4 variables
plot(X(idx),Y(idx,:));
You may also be interested in plotting every 100th observation to thin out the sample and make it more readable. To do this, assign idx = 1:100:length(X);
Hope this helps.
  3 comentarios
sally_wu
sally_wu el 14 de Oct. de 2015
I have this 116100x1, and want to plot ecdf
Kirby Fears
Kirby Fears el 14 de Oct. de 2015
Editada: Kirby Fears el 14 de Oct. de 2015
The point of my answer is to demonstrate how to plot any vector of this size. Using the ecdf() output is no different. Here is an example:
X=(1:116100)';
Y=1022+16512*randn(size(X));
[a,b] = ecdf(Y);
plot(b,a);
Please give this a try and adapt it to work for your own code.
Hope this helps.

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by