matrix based on vector and diagonal elements=1 using matlab -
How do I create the following matrix
1 0 0 k1 1 0 0 0 k2 k1 1 0 k3 k2 k1 1 k4 k3 k2 k1 1
Usage Please.
Example
vector = [1 2 3 4 5]; Change it with values for% 1 [1 k1 k2 k3 k4] = toeplitz (vector, [0]] outside = 1 0 0 0 2 1 0 0 0 0 2 2 0 0 4 3 2 1 0 5 4 3 2 1
Edit
My vector [k1 k2 k3 k4 k5], how do Can I apply tril or toeplitz?
Using more convenient formulation of @ gnovice, you use
yourVector = [k1 k2 k3 k4 k5]; Tril (toeplitz ([1 yourVector (1: 4)]))
Comments
Post a Comment