Random Noise Generation Error

조회 수: 1 (최근 30일)
Nicholas Wagter
Nicholas Wagter 2019년 6월 20일
댓글: Adam Danz 2019년 6월 26일
this is a question
  댓글 수: 1
Adam Danz
Adam Danz 2019년 6월 26일
Please revert the question.

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2019년 6월 20일
편집: Adam Danz 2019년 6월 21일
You're running 96256 total loops which will take a while. It looks like you terminated the process while waiting.
To see the progress during execution, use waitbars. They will add slightly to the processing time but the benefit is that 1) you know it's working, 2) you can see how far the progress is, and 3) if there is an error, you can see exactly where in the loop(s) the error ocurred.
wb1 = waitbar(0,'i loop 0/376');
wb2 = waitbar(0,'j loop 0/256');
wb2.Position(2) = wb1.Position(2)-wb2.Position(4)-30; %put waitbar 2 under wb1
for i = 1:376
waitbar(i/376,wb1,sprintf('i loop %d/376',i))
for j = 1:256
waitbar(j/256,wb2,sprintf('j loop %d/256',j))
Noise = 5*randn(1,length(t1));
Decrease_Factor = 356; %if this is really a constant, move it out of the loop!
Dec_NSignal = decimate(Noise,Decrease_Factor);
Dec_NSignal2 = decimate(Dec_NSignal,3);
N(i,j,1:100) = Dec_NSignal2;
end
end
delete([wb1,wb2])
Also, properly allocate the N variable.
N = zeros(376,256,100);
  댓글 수: 1
Nicholas Wagter
Nicholas Wagter 2019년 6월 21일
Ok, awesome thankyou so much for the advice!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by