Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
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);

Réponse acceptée

KSSV
KSSV le 20 Août 2020
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);

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by