14 views (last 30 days)

John Chilleri
on 1 Mar 2017

Edited: John Chilleri
on 1 Mar 2017

Hello,

If I understand your question correctly, then this might help:

data = xlsread('data.xls');

sf = (0:.5:2.5)';

cumsum_sf = zeros(length(sf),1);

for i = 1:length(sf)

cumsum_sf(i) = numel(find(data(:,1)<=sf(i)))-sum(cumsum_sf);

end

plot(sf, cumsum_sf)

This is just an idea of how to go about it, you can always set up a loop and count if it's greater than blah and less than blah+.05.

Hope this helps!

John Chilleri
on 1 Mar 2017

To do greater than or equal to, you could use the same code but change the equality:

data = xlsread('data.xls');

sf = (0:.5:2.5)';

cumsum_sf = zeros(length(sf),1);

for i = 1:length(sf)

cumsum_sf(i) = numel(find(data(:,1)>=sf(i)));

end

plot(sf, cumsum_sf)

Is this what you were looking for?

Also, note that if you want .05,.1,..,.3 change the second line,

sf = (0:.5:2.5)';

to

sf = (.05:.05:.3)';

With your data set however, I wouldn't recommend using sf = .05:.05:.3.

Hope this helps!

John Chilleri
on 2 Mar 2017

Yes, you can do so by placing the columns side by side into a matrix as follows:

sf_and_cumsumsf = [sf cumsum_sf];

Hope this helps!

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.