フィルターのクリア

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

3 ビュー (過去 30 日間)
Can someone please help me to correct the above mentioned problem in the following matlab code ?
T = 5; %period
sample = 44100*20; % samples
period = 4; %required number of periods
SinglePeriod = linspace (0, T, 44100*5 + 1); %single period
SinglePeriod(end) = []; %time vetor
t = linspace(0, T*period, sample+1); %time vector required
t(end) = [];
s3 = zeros(1, period);
s3(SinglePeriod >= 0 & SinglePeriod < 2.5) = ((A*SinglePeriod)/4);
s3(SinglePeriod >= 2.5 & SinglePeriod < 5) = (((-A*SinglePeriod)+(5*A))/4);
The 'entire' error message is:
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in mission (line 66)
s3(SinglePeriod >= 0 & SinglePeriod < 2.5) = ((A*SinglePeriod)/4);

採用された回答

KSSV
KSSV 2020 年 8 月 20 日
T = 5; %period
sample = 44100*20; % samples
period = 4; %required number of periods
SinglePeriod = linspace (0, T, 44100*5 + 1); %single period
SinglePeriod(end) = []; %time vetor
t = linspace(0, T*period, sample+1); %time vector required
t(end) = [];
s3 = zeros(1, period);
s3(SinglePeriod >= 0 & SinglePeriod < 2.5) = ((A*SinglePeriod(SinglePeriod >= 0 & SinglePeriod < 2.5))/4);
s3(SinglePeriod >= 2.5 & SinglePeriod < 5) = (((-A*SinglePeriod(SinglePeriod >= 2.5 & SinglePeriod < 5))+(5*A))/4);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by