Effacer les filtres
Effacer les filtres

Re-write the following code so that it avoids using a loop. N = 10; a = zeros(1, N); b = zeros(1, N); for i = 1:N a(i) = i; b(i) = a(i) * a(i); end

2 vues (au cours des 30 derniers jours)
Abigail McGahey
Abigail McGahey le 19 Fév 2019
Commenté : Abigail McGahey le 19 Fév 2019
  1. Re-write the following code so that it avoids using a loop.
N = 10;
a = zeros(1, N);
b = zeros(1, N);
for i = 1:N
a(i) = i;
b(i) = a(i) * a(i);
end
  4 commentaires
Abigail McGahey
Abigail McGahey le 19 Fév 2019
thank you! this helped a lot!!!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Problem-Based Optimization Setup dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by