Unable to perform assignment because the size of the left side is 1-by-10 and the size of the right side
4 ビュー (過去 30 日間)
古いコメントを表示
Bradley Kitzul
2020 年 12 月 27 日
コメント済み: Walter Roberson
2020 年 12 月 29 日
Hi, I am getting this error message.
Unable to perform assignment because the size of the left side is 1-by-10 and the size of the right side
is 1-by-6.
Error in codeRun (line 57)
[z_1,b(1, 1:10),terms_1,candIndex(1, 1:9)]= FOS(inp1,N/3,M,NO,trm1,t);
I am not sure why I am getting this error message as the only thing I am changing is getting rid of white gaussian noise to my signal (commented out and replaced it with just y.
% adding white gaussian noise to the signal
%in1=y;
%v = awgn(y,5,'measured');
%in=in1+v;
in = y;
Sorry if my question in rudimentary, I am new to coding! Thank you :D
2 件のコメント
Cris LaPierre
2020 年 12 月 28 日
We don't have enough of your code to really say for certain why this change is causing this error. For starters, please include the entire error message (all the red text).
You might consider attaching your code and data files if there are any using the paperclip icon so we can try to reproduce the error on our end.
採用された回答
Walter Roberson
2020 年 12 月 28 日
if (abs(Qmax) < abs(Q1))
noise=1; % only noise remains
else
% complete searching
mse=mse-Qmax;
D=Dmax;
p=pmax;
c=cmax;
g=gmax;
alpha=alphamax;
m=m+1;
end
When you detect noise, you do not increase m . There will be a variable number of segments detected as noise, so you expect a variable output for m.
M=m-1;
terms=M; %# of terms chosen by FOS
So M is expected to vary in size.
a(1)=g(M);
for i=1:M
v(i) = 1;
for m = i+1:M
v(m) = - sum(alpha(m, i:m-1) .* v(i:m-1));
end
a(i) = sum(g(i:M) .* v(i:M));
end
You create up to a(M), so a will vary in size.
[z_1,b(1, 1:10),terms_1,candIndex(1, 1:9), eratio]= FOS(inp1,N/3,M,NO,trm1,t);
but your code is expecting a vector of exactly 10 values each time.
M=10;% Maximum term to add
Notice the "maximum". Not a fixed number, a maximum.
Your code should be receiving the output into an un-indexed variable, and doing something with results that are shorter because noise was detected. Pad them with zeros or something. And only then write the result into b.
2 件のコメント
Walter Roberson
2020 年 12 月 29 日
[z_1,bt,terms_1,candIndex(1, 1:9), eratio]= FOS(inp1,N/3,M,NO,trm1,t);
bt(11)=0; %pad short
b(1,1:10) = bt(1:10);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Time-Frequency Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!