Make series in matrix

3 ビュー (過去 30 日間)
Jonas Maes
Jonas Maes 2020 年 10 月 21 日
コメント済み: Jonas Maes 2020 年 10 月 21 日
Hello
I'm trying to create a 1000x1000 matrix in which each row is elevated to an ascending power. This is what I've got written down:
h=0;
for x=1:1:1000
v=1:1:1000;
w=[v.^x];
h=h+1;
end
A=ones(10,10)*w;
EXAMPLE: This is what I want for a 5x5 matrix:
v=1:1:10;
A=[v;v.^2;v.^3;v.^4;v.^5]

採用された回答

KSSV
KSSV 2020 年 10 月 21 日
編集済み: KSSV 2020 年 10 月 21 日
x = 1:5 ;
p = 1:5 ;
A = x'.^p ;
%%
A = repmat(x,5,1) ;
B = (A'.^p)'
  3 件のコメント
KSSV
KSSV 2020 年 10 月 21 日
Edited the answer..check..
Jonas Maes
Jonas Maes 2020 年 10 月 21 日
Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by