scalar to vector formation, k = [k1 k2 k3 k4] to [k1,-k1,0,​0:-k1,k1+k​2,-k2,0:0,​-k2,k2+k3,​0:0,0,-k3,​k3+k4]

21 vues (au cours des 30 derniers jours)

Réponse acceptée

Stephen23
Stephen23 le 25 Nov 2018
Modifié(e) : Stephen23 le 25 Nov 2018
k = [0.6337,0.6337,0.6337,0.6337];
n = numel(k);
m = zeros(n);
m(2:n+1:end-n) = 0-k(1:end-1); % lower
m(1+n:n+1:end) = 0-k(1:end-1); % upper
m(1:n+1:end) = [0,k(1:end-1)]+k % main
Giving:
m =
0.63370 -0.63370 0.00000 0.00000
-0.63370 1.26740 -0.63370 0.00000
0.00000 -0.63370 1.26740 -0.63370
0.00000 0.00000 -0.63370 1.26740

Plus de réponses (0)

Catégories

En savoir plus sur Elementary Math dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by