how to create 2X10000 matrix using for loop in matlab

2 vues (au cours des 30 derniers jours)
Kishore
Kishore le 12 Août 2014
Commenté : Kishore le 14 Août 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
  1 commentaire
Pratik Bajaria
Pratik Bajaria le 12 Août 2014
Could you please elaborate the question..?

Connectez-vous pour commenter.

Réponses (3)

Image Analyst
Image Analyst le 12 Août 2014
Modifié(e) : Image Analyst le 12 Août 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 le 12 Août 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 le 12 Août 2014
x0 = reshape(X,2,[]);
x1 = [x0(1,:);-conj(x0(2,:))];
x2 = [x0(2,:);conj(x0(1,:))];
tX = [x1(:).';x2(:).'];
  1 commentaire
Kishore
Kishore le 14 Août 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by