Cannot get output printed for every iteration of while loop.
이전 댓글 표시
I've been assigned a problem where I'm trying to print out a vector for each iteration of this while loop. Unfortunately it seems like it will only print out the vector when n = 13, when I need printed vectors from n=2 to 13.
n=2;
inc=1;
while n < 100
H_mat=hilb(n);
x_vec=rand(n,1);
b_vec=H_mat*x_vec;
x_approx=H_mat\b_vec;
fprintf('Approximate x value: \n');
disp(x_approx);
if (n > 13)
break;
end
n = n + 1; % Increment n for the next iteration
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Hilbert and Walsh-Hadamard Transforms에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!