how can i average array 1 based on values in array 2
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I'm trying to average values of drag from CFD modeling. The velocities change based on the iteration. an example of My data is shown in the picture.

What i would like to do is separate the C_d at various points ie. 0-10k, 10k-20k, 20-30k etc. problem is the data is not rigid ie the difference between each data point is not regular, so some version of the find function i assume would likely be needed.
then i would like to see (plot) each section to better visualize and see how long the section took to stabilize. once stabilized, i would like to take the mean for each section. for example.
- find 0-10k plot 0-10k mean 2k-10k
- find 10-20k plot 10k-20kmean 14k-20k
I can write the loop once i am able to 'find, plot and mean' my data. Any help would be greatly appreciated
Respuestas (1)
Azzi Abdelmalek
el 15 de Feb. de 2014
c1=40*sort(rand(40,1))
c2=rand(40,1)
[ii,jj]=histc(c1,0:10:40);
ii=[0 ;cumsum(ii(1:end-1))]
for k=1:numel(ii)-1
idx=ii(k)+1:ii(k+1);
plot(c1(idx),c2(idx))
moy{k}=mean(c2(idx))
hold on
end
hold off
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!