is there anyone assist me for write a for loop that will calculate the power n of a given number x on MATLAB?

1 view (last 30 days)
thanks in advance
  3 Comments

Sign in to comment.

Accepted Answer

Jos (10584)
Jos (10584) on 31 Mar 2016
n = 4
x = 2
y = 1
for k=1:n
y = y * x
end
[x.^n y]

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!