Clear Filters
Clear Filters

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 view (last 30 days)
  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 Comments

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!