필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Problem with for loop.

조회 수: 1 (최근 30일)
Max
Max 2016년 3월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello,
I´ve got a problem with the calculation of a matrix in a for loop. It seems easy to solve but I can´t find my fault in the following source code:
N=100
for i=1:10
tfail = ixN-vector
tfail_sort = sort(tfail);
t_boot=0:1:max(tfail);
z_boot=zeros(1,length(t_boot));
for k=1:length(tfail);
z_boot(k,:)=1.*(t_boot>=0 & t_boot<tfail_sort(k));
z_boot(k,:)=z_boot(k,:)+0.*(t_boot>=tfail_sort(k));
end
R_m_boot(i,:) = (1/N)*sum(z_boot); % Sum the columns
end
Can somebody help me, please?
  댓글 수: 2
Jos (10584)
Jos (10584) 2016년 3월 2일
What is the error you get?
Jan
Jan 2016년 3월 2일
All we see ist the failing code. But we cannot guess, what it should do.
It cannot be useful to perform
z_boot(k,:) = z_boot(k,:) + 0 .* <anything>;
The multiplication by 0 is not useful in a sum.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by