Getting an error saying "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters"
6 ビュー (過去 30 日間)
古いコメントを表示
Here is my code that I have and I have checked to make sure there are correct number of parenthesis on both sides, but continues to give this error. Any help would be appreciated.
Code:
%%Root Mean Square envelope (moving average)- mean power of signal
envelope=zeros(L,4); %L= length(data)
%Window size in ms
window=50; %larger more of original signal but distortion and spikey, lower number could be flat
for i=1:4
envelope(:,i) = sqrt(movmean(((rec_signal(:,i).^2),window)));%Average according to moving window size; %sim to RMS
end
0 件のコメント
採用された回答
Image Analyst
2025 年 7 月 11 日
編集済み: Image Analyst
2025 年 7 月 11 日
You have too many parentheses. This works:
L = 21;
rec_signal = rand(L, 4);
%% Root Mean Square envelope (moving average) - mean power of signal
envelope = zeros(L,4); % L = length(data)
% Window size in ms
window = 50; % Larger more of original signal but distortion and spikey, lower number could be flat
for i = 1 : 4
envelope(:,i) = sqrt(movmean((rec_signal(:,i).^2),window)); % Average according to moving window size; %sim to RMS
end
2 件のコメント
Image Analyst
2025 年 7 月 11 日
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
For full details on how to earn reputation points see: https://www.mathworks.com/matlabcentral/answers/help?s_tid=al_priv#reputation
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Bartlett についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!