我在MATLAB中遇到困难,如果有人可以提供帮助,我将不胜感激。这是我想做的。我有一个速度场数据w.r.t.时间(见附图)。
答案 0 :(得分:0)
我建议使用bwconncomp
:
A = rand(1,100); %your 1d list of speeds
T = 0.5;
B = A > T;
tmp = bwconncomp(B);
pxlist = tmp.PixelIdxList; %connected components are above thresh
N = zeros(1,length(pxlist));
V = zeros(1,length(pxlist));
for li = 1:length(pxlist)
N(li) = length(pxlist{li});
V(li) = mean(A(pxlist{li})); %avg velocity in interval li
end
avg = mean(N); %this is the avg. "time", i.e. length of connected components