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
    5 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
% 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
a=min(z);
b=max(z);
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))
uMatrix(j,1,i)=z(i);
end
end
end
for i=1:k
temp1=uMatrix(i,:,:);
%whos temp1
temp2 = nonzeros(temp1);
%whos temp2
temp3 = length(temp2);
%w hos temp3
le(i)=temp3;
end
2 commentaires
  John D'Errico
      
      
 le 27 Août 2016
				
      Modifié(e) : John D'Errico
      
      
 le 27 Août 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.
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

