-5
這個問題是關於使用matlab對數據進行分箱。我有兩個數據集。在一個數據集中,我使用x(代表速度)和y(代表功率)值對數據進行分類,並計算平均標準差,邊沿和h值(請參閱代碼),藉助該計算我需要識別並傳遞傳入數據(這裏是代碼中的這個是newdata)到它們所屬的特定的bin(我已經準備好在這裏給出下面的代碼),。在下面的代碼中,newdata將包含與bin匹配的新數據集。請幫我在哪裏,我會犯錯或修改它,我收到以下錯誤:任何人都可以幫助我在我的matlab編程中犯錯誤嗎?
Error using >
Matrix dimensions must agree.
Error in Binning_Online (line 23)
newdatabin=find(newdata>binEdges,1,'last'); %this is the bin number where the new data goes in
代碼:
x= load speed;
y= load power;
newdata= load new_speed;
topEdge = 20; % upper limit
botEdge = 5; % lower limit
numBins = 40; % define number of bins
[N,edges,bins] = histcounts(y_vector,numBins);
Pow_means = []; speed_means = [];
for n = 1:numBins;
Pow_means(n,1) = mean(x_vector(bins==n,1)); % for each bins mean value calculation.
speed_means(n,1) = mean(y_vector(bins==n,1)); % for each bins mean value calculation.
pow_std(n,1) = std(x_vector(bins==n,1)); % for Standard deviation calculation
binEdges = linspace(botEdge, topEdge, numBins+1);
newdatabin= find(newdata>binedges,1,'last'); %this is the bin number where the new data goes in
h(newdatabin)=h(newdatabin)+1;
end
什麼問題? – user4759923
你爲什麼不寫錯誤信息? – giosans
@giosans這是我得到的錯誤:錯誤使用> 矩陣尺寸必須一致。 Binning_Online錯誤(第23行) newdatabin = find(newdata> binEdges,1,'last'); %這是新數據進入的bin號碼 –