I have been unable to find a function in matlab or octave to do what I want. I have a matrix m of two columns (x and y values). I know that I can extract the column by doing m(:,1) or m(:,2). I want to split it into smaller matricies of [potentially] equal size and and plot the mean of these matricies. In other words, I want to put the values into bins based on the x values, then find means of the bins. I feel like the hist function should help me, but it doesn t seem to.
有没有任何内置函数可以做类似于这样的事情?
编辑
我原打算提到我看了看历史记录,但没能让它按照我想要的方式运行,但可能我忘了。
让我们假设我有以下内容(我在尝试在Octave中使用,但据我所知,这也适用于Matlab):
x=1:20;
y=[1:10,10:1];
m=[x, y];
如果我想要10个箱子,我希望m被分成:
m1=[1:2, 1:2]
...
m5=[9:10, 9:10]
m6=[10:11, 10:-1:9]
...
m10=[19:20, 2:-1:1]
然后获取每个箱的平均值。
更新:我在这里发布了一个后续问题。真诚希望得到回应。