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

1 回表示 (過去 30 日間)
Abigail McGahey
Abigail McGahey 2019 年 2 月 19 日
コメント済み: Abigail McGahey 2019 年 2 月 19 日
  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 件のコメント
Abigail McGahey
Abigail McGahey 2019 年 2 月 19 日
thank you! this helped a lot!!!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by