Hello! I want to implement the following matrix:
where is a given vector of random indices
Can someone help me to implement that?

댓글 수: 3

madhan ravi
madhan ravi 2020년 7월 19일
Did you do anything for your homework?
Franziska Bömann
Franziska Bömann 2020년 7월 19일
yes, I did, but I cannot understand how to implement matrices, thats why I'm always asking about matrices.
madhan ravi
madhan ravi 2020년 7월 19일
Ok , can you upload what you have tried?

댓글을 달려면 로그인하십시오.

 채택된 답변

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 7월 19일

0 개 추천

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
Bruno Luong 2020년 7월 19일
편집: Bruno Luong 2020년 7월 19일

0 개 추천

n = 3;
x = rand(n+1,1);
A = cumprod([ones(size(x)), (x-x(1:end-1).')], 2)

댓글 수: 1

madhan ravi
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by