implementation of a matrix
2 ビュー (過去 30 日間)
古いコメントを表示
Franziska Bömann
2020 年 7 月 19 日
編集済み: madhan ravi
2020 年 7 月 19 日
Hello! I want to implement the following matrix:
where is a given vector of random indices
Can someone help me to implement that?
3 件のコメント
採用された回答
Thiago Henrique Gomes Lobato
2020 年 7 月 19 日
This should do:
rng(42)
n = 3;
x = rand(n,1);
A = ones(n,n+1);
Differences = x-x';
for idx=2:n+1
A(:,idx) = A(:,idx-1).*Differences(:,idx-1);
end
x
A
x =
0.3745
0.9507
0.7320
A =
1.0000 0 0 0
1.0000 0.5762 0 0
1.0000 0.3575 -0.0782 0
その他の回答 (1 件)
Bruno Luong
2020 年 7 月 19 日
編集済み: Bruno Luong
2020 年 7 月 19 日
n = 3;
x = rand(n+1,1);
A = cumprod([ones(size(x)), (x-x(1:end-1).')], 2)
1 件のコメント
madhan ravi
2020 年 7 月 19 日
編集済み: madhan ravi
2020 年 7 月 19 日
But why though? It’s pretty obvious it’s a homework question? It’s not a homework solving contest XD.
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!