Filter löschen
Filter löschen

hi, i want partition largest interval(contain more than element) to 4 interval , and partition the second biggest interval to 3 interval,and partition the third biggest interval to 3 interval, But the rest remains the same.retaining orderofinterval

1 Ansicht (letzte 30 Tage)
% i have n values z1,z2 , ...,zn this is numerical values . i partition this to seven interval as following and calculate the length for every interval(length for nonzero element), the interval contain more than element from z1,...zn i need partition it to 4 subinterval have same length While retaining the order and the second largest interval partition to 3 subinterval have same length and the third interval partition to 2 subinterval have same length and the remaining interval Remain the same . In the end we get to 13 interval .
n = 50;
z = 1000 * rand(1, n); % Sample data
k =7; % such that k is the number of intervals
L= (max(z)-min(z))/k; %such that L is length of each interval
% Here is my solution:
intK = round(k);
uMatrix = [linspace(a, b-L, intK)', linspace(a+L, b, intK)']
for i=1:n
for j=1:k
if (uMatrix(j,1)<=z(i)&z(i)<=uMatrix(j,2))
for i=1:k
%whos temp1
temp2 = nonzeros(temp1);
%whos temp2
temp3 = length(temp2);
%w hos temp3
  2 Kommentare
John D'Errico
John D'Errico am 27 Aug. 2016
Bearbeitet: John D'Errico am 27 Aug. 2016
Maybe the reason there was no answer is because your question is so confusingly stated. But asking the same question over and over again won't get any better response.
It is not at all obvious to me what you want to do here. So slow down. Try making your goals clearer, more easily understood.

Melden Sie sich an, um zu kommentieren.

Antworten (0)


Mehr zu Programming finden Sie in Help Center und File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by