【发布时间】:2022-08-15 02:26:36
【问题描述】:
我是 octave 的新手,如果有人问过并回答过,那么我很抱歉,但我不知道这句话是什么意思。
我试图从一个大矩阵中删除直流分量,但是因为我需要对每个卡盘进行计算,所以需要分块。
到目前为止我得到了什么
r = dlmread(\'test.csv\',\';\',0,0);
x = r(:,2);
y = r(:,3); % we work on the 3rd column
d = 1
while d <= (length(y) - 256)
e = y(d:d+256);
avg = sum(e) / length(e);
k(d:d+256) = e - avg; % this is the part I need help with, how to get the chunk with the right value into the matrix
d += 256;
endwhile
% to check the result I like to see it
plot(x, k, \'.\');
如果我将行更改为:
k(d:d+256) = e - 1024;
它完美地工作。
我知道有类似元素操作的东西,但如果我使用 e .- avg 我得到这个:
警告:\'.-\' 运算符在版本 7 中已弃用
它仍然没有达到我的预期。
我一定错过了什么,有什么建议吗?
Linux(Manjaro)上的 GNU Octave,版本 7.2.0。
标签: octave elementwise-operations