Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Bin my Data set

Asked by Kaelyn on 1 Dec 2012

Hello I am trying to bin my data down. I have a data set and when I graph it I do not want to it be the raw data exactly. so far I have I don't know where to go from here. I am trying to get the velocity numbers that are between 1 and 2 and take the average and plot this point.

%Code

v=data(:,2); w=zeros(1,13);

for j=1:9995 %number of data points

    for i=1:14;___      % velocity parameters
      if v(i)>1 && v(i)<=2;
           w(i+1)=w(i+1)+v(j);
           N=mean(w(i+1));
      end
    end
end

figure(1) plot(N,'*');

0 Comments

Kaelyn

Tags

Products

No products are associated with this question.

1 Answer

Answer by Matt Fig on 1 Dec 2012
Edited by Matt Fig on 1 Dec 2012
Accepted answer
v = data(:,2);  % Velocity
mv12 = mean(v(v>=1 & v<=2))  % Mean of velocity on [1 2].

1 Comment

Kaelyn on 1 Dec 2012

Thanks it gave me the right answer :)

Matt Fig

Contact us