how to manage matrix construction?
Ältere Kommentare anzeigen
hi guys

i need a code to construct this matrix, the code should allow the user to insert h1,h2...h(n-1)
Akzeptierte Antwort
Weitere Antworten (1)
Star Strider
am 20 Nov. 2014
1 Stimme
4 Kommentare
janny
am 23 Nov. 2014
Star Strider
am 23 Nov. 2014
Bearbeitet: Star Strider
am 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
am 25 Nov. 2014
Star Strider
am 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);
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!