Advertisement
lalkaed

LatweZadanie

Aug 30th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.23 KB | None | 0 0
  1. x = [1,2,2,4,9]
  2. n = 2
  3. wynik = potenga(x,n)
  4. function wynik = potenga(x,n)
  5. %Funkcja, która dla argumentów n i x (gdzie n to skalar a x to wektor)
  6. %zlicza sumę n-tych potęg wartości z wektora x.
  7. x = x.^n
  8. wynik = sum(x(:))
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement