kronecker product in a matrix
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ali Esmaeilpour
am 14 Mai 2019
Bearbeitet: Geoff Hayes
am 30 Mai 2019
hx = [-1/sqrt(5);-2/sqrt(5)] and hu = [0;0] and i = 1 and N = 5
I want to find a code for hk, tnx!
Akzeptierte Antwort
Geoff Hayes
am 30 Mai 2019
Bearbeitet: Geoff Hayes
am 30 Mai 2019
Ali - perhaps the code could be
h = zeros((2*N + 1) * size(hx,1), N);
for k=1:N
Ekn1 = zeros(N,1);
Ekn1(k) = 1;
Ekn2 = zeros(N+1,1);
Ekn2(k) = 1;
h(:,k) = [kron(Ekn2,hx);kron(Ekn1,hu)];
end
See https://www.mathworks.com/matlabcentral/answers/464248-produce-matrices-through-for-loop for the same question.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!