필터 지우기
필터 지우기

Why do I receive Sigmult problem?

조회 수: 6 (최근 30일)
LORENZ LAURENCIANO
LORENZ LAURENCIANO 2022년 5월 17일
답변: Krishna 2022년 8월 26일
Hi there! I'm facing, I guess a classical error. Here is the code:
and I got an error prompted like this:
I know that this kind of error is trivial, I find it difficult to solve it since I am new on these kind of lesson. I hope I get answers. Thank you!

답변 (1개)

Krishna
Krishna 2022년 8월 26일
I understand that you are facing problem while debugging the sigmult error.
Here is an example which can help you debug the issue if you have got assignment errors due to the left and right sides having different number of elements.
The error is mainly because you are trying to save more/ less number of elements than the LHS is indexed to.
Try running the code with the steps given below:
A = zeros(1,5) ;
A(1) = rand(1,2) ; % trying to save two numbers at single location; so error
A(1:3) = rand(1,2) ; % trying to save two numbers at two locations; so error
You may need to replace the below lines
y1((n>=min(n1))&(n<=max(n1))==1)=x1; % x1 with duration of y
y2((n>=min(n2))&(n<=max(n2))==1)=x2; % x2 with duration of y
with
idx1 = (n>=min(n1))&(n<=max(n1))==1 ;
y1((idx1)=x1(idx1); % x1 with duration of y
idx2 = (n>=min(n2))&(n<=max(n2))==1 ;
y2(idx2)=x2(idx2); % x2 with duration of y

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by