how to manage matrix construction?
Afficher commentaires plus anciens
hi guys

i need a code to construct this matrix, the code should allow the user to insert h1,h2...h(n-1)
Réponse acceptée
Plus de réponses (1)
Star Strider
le 20 Nov 2014
1 vote
4 commentaires
janny
le 23 Nov 2014
Star Strider
le 23 Nov 2014
Modifié(e) : Star Strider
le 23 Nov 2014
This isn’t actually a companion form matrix, but it has the form you want:
h = randi(10,1,4); % Create ‘h’ Vector
D = diag(ones(1,length(h)),1);
D(end,:) = [1 h];
janny
le 25 Nov 2014
Star Strider
le 25 Nov 2014
I have no idea what you’re doing. To make it binary with the randi function, change that line to:
len = 4; % Length of number string
h = randi([0 1],1,len);
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!