Cannot get output printed for every iteration of while loop.
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Hilbert and Walsh-Hadamard Transforms dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!