how to create 2X10000 matrix using for loop in matlab

2 visualizaciones (últimos 30 días)
Kishore
Kishore el 12 de Ag. de 2014
Comentada: Kishore el 14 de Ag. de 2014
I am trying to create a matrix of size 2X10000 using for loop ie If
X={x1 x2 x3 x4 x5 x6 x7 x8 x9 x10............}
them my
tX1=[x1 -x2* x3 -x4* x5 -x6* ...........] row 1 from matrix in for loop
tX2=[x2 x1* x4 x3* x6 x5* ...........] row 2 from matrix in for loop

Respuestas (3)

Image Analyst
Image Analyst el 12 de Ag. de 2014
Editada: Image Analyst el 12 de Ag. de 2014
Seems pretty easy, assuming * means complex conjugate. Did you try anything like this
for k = 1 : 2 : length(X)-1
tX1(k) = X(k);
tX1(k+1) = -conj(X(k+1)); % Negative complex conjugate.
tX2(k) = X(k+1);
tX2(k+1) = conj(X(k));
end

dpb
dpb el 12 de Ag. de 2014
Given an x vector of length 20003,
X=[x(1) -x(2:2:end-2).*x(3:2:end-1); ...
x(2) x(1:2:end-3).*x(4:2:end)]

Andrei Bobrov
Andrei Bobrov el 12 de Ag. de 2014
x0 = reshape(X,2,[]);
x1 = [x0(1,:);-conj(x0(2,:))];
x2 = [x0(2,:);conj(x0(1,:))];
tX = [x1(:).';x2(:).'];
  1 comentario
Kishore
Kishore el 14 de Ag. de 2014
Thank u andrei bobrov this block should work within for loop ie i need to convert 1XN matrix to 2XN matrix using for loop

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by