How to create a matrix where the value shifts to the write with each row? And how do I create a vector that increases and then decreases?

11 visualizzazioni (ultimi 30 giorni)
I need to make a square matrix that is 583x583. With every row, the values shift to the right and the values shift to the right are zeros. In other words, the matrix needs to be shaped like this:
F= [ F(1) 0 0......0
[ F(2) F(1) 0 0 .....0
[F(583) F(582)........F(1)]
The issue that I'm also having is creating the values for F. The values are based on a graph that increases and then decreases. So it has to be:
F=[10E-1 10 10E-1 10E-2 9E-3 8E-3 7E-3 6E-3........]. How do I create a for loop that will decrease the values like that?

Risposte (1)

Matt J
Matt J il 3 Nov 2021
F=[10E-1 10 10E-1 10E-2 , (9:-1:1)*1e-3];
toeplitz(F,[F(1), zeros(1,numel(F)-1 )])
ans = 13×13
1.0000 0 0 0 0 0 0 0 0 0 0 0 0 10.0000 1.0000 0 0 0 0 0 0 0 0 0 0 0 1.0000 10.0000 1.0000 0 0 0 0 0 0 0 0 0 0 0.1000 1.0000 10.0000 1.0000 0 0 0 0 0 0 0 0 0 0.0090 0.1000 1.0000 10.0000 1.0000 0 0 0 0 0 0 0 0 0.0080 0.0090 0.1000 1.0000 10.0000 1.0000 0 0 0 0 0 0 0 0.0070 0.0080 0.0090 0.1000 1.0000 10.0000 1.0000 0 0 0 0 0 0 0.0060 0.0070 0.0080 0.0090 0.1000 1.0000 10.0000 1.0000 0 0 0 0 0 0.0050 0.0060 0.0070 0.0080 0.0090 0.1000 1.0000 10.0000 1.0000 0 0 0 0 0.0040 0.0050 0.0060 0.0070 0.0080 0.0090 0.1000 1.0000 10.0000 1.0000 0 0 0

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by