integrate 3 matrix into one matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
fatema saba
am 22 Dez. 2014
Kommentiert: fatema saba
am 22 Dez. 2014
Hello
I have a problem.
I have 3 matrices (q,e and w) like that:
q=[1:4]
e=q'
and
w=zeros(3,3)
I want to create matrix A by integrating matrix q, e and w
matrix A must be something like that:
A=[1 2 3 4;
2 0 0 0;
3 0 0 0;
4 0 0 0]
I write something but It doesn't work correctly
my code is:
function [ A ] = gams1(q,e,m,n)
q=[1:4]
e=q'
w=zeros(3,3)
m=4
n=4
A=zeros(m,n)
for i=1:m*n
if i==i>=1 && i<=n
iA=q
continue
elseif rem(i,n)==1
iA=e
end
end
[A]
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 22 Dez. 2014
Bearbeitet: Andrei Bobrov
am 22 Dez. 2014
A = [e,[q(2:end);w]];
OR
A = hankel(q);
A(2:end,2:end) = 0;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!