필터 지우기
필터 지우기

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?

조회 수: 12 (최근 30일)
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?

답변 (1개)

Matt J
Matt J 2021년 11월 3일
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

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by