Clear Filters
Clear Filters

How to create a matrix?

1 view (last 30 days)
jack star
jack star on 2 Apr 2016
Commented: jack star on 2 Apr 2016
Hi all, I am trying to create a matrix (101x101) like this :
Can anyone help me with the code please?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 2 Apr 2016
Edited: Azzi Abdelmalek on 2 Apr 2016
n=4 % in your case use n=101
out=tril(2*ones(n),-1)
  1 Comment
jack star
jack star on 2 Apr 2016
Thank you very much for your answer.
Now I'm trying to solve this matrix:
Y= U x g
% Y(101x1) and U(101x101) matrixes.
to find g, i used this g = inv(U)*Y
But it found g(101x1) NaN matrix. You have any idea why?

Sign in to comment.

More Answers (0)

Categories

Find more on Operating on Diagonal Matrices 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!