In an assignment A(I) = B, the number of elements in B and I must be the same.

How to get rid of this error!! this is my code below for
for i = 18:-1:13
test=ff(i)
[B,A] = oct3dsgn(ff(i),Fs,N);
if narg
y = filter(B,A,x);
test=sum(y)
P(i) = sum(y.^2)/m;

3 件のコメント

Jan
Jan 2013 年 7 月 10 日
編集済み: Jan 2013 年 7 月 10 日
Seeing the code, which produces an error, does not allow to fix it as long as the intention is not clear.
The dimensions of the used variables matter, so please post all required details.
Satya Narayaan Rao
Satya Narayaan Rao 2013 年 7 月 11 日
Ya Y is a complex number a+Bi so does it occupy more than one cell after performing the operation and Y is a row matrix.
i am squaring all the elements and then summing them so do need to assign different memory allocation different
pi = 3.14159265358979;
Fs = 25600; % Sampling Frequency
N = 3; % Order of analysis filters.
F = [ 50 100 125 160, 200 250 315, 400 500 630, 800 1000 1250, ... 1600 2000 2500, 3150 4000 5000 ]; % Preferred labeling freq.
ff = (1000).*((2^(1/3)).^[-10:7]); % Exact center freq. P = zeros(1,18);
P=double(P);
if narg
m = length(x);
end;
% Design filters and compute RMS powers in 1/3-oct. bands % 5000 Hz band to 1600 Hz band, direct implementation of filters. BB=[];
AA=[];
for i = 18:-1:13
test=ff(i)
[B,A] = oct3dsgn(ff(i),Fs,N);
if narg y = filter(B,A,x);
test=sum(y.^2);
P(i) =test/m;

サインインしてコメントする。

回答 (1 件)

Tom Lane
Tom Lane 2013 年 7 月 11 日

1 投票

If the variable y is not a vector (if it is a matrix with more than 1 row and column), then sum(y.^2) is not a scalar. It looks like you are trying to assign it into a single element of P.

1 件のコメント

Satya Narayaan Rao
Satya Narayaan Rao 2013 年 7 月 11 日
Ya y is a row matrix. it contains more than one row or shall i double p

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

タグが未入力です。

質問済み:

2013 年 7 月 10 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by