how to create 2X10000 matrix using for loop in matlab

2 ビュー (過去 30 日間)
Kishore
Kishore 2014 年 8 月 12 日
コメント済み: Kishore 2014 年 8 月 14 日
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 件のコメント
Pratik Bajaria
Pratik Bajaria 2014 年 8 月 12 日
Could you please elaborate the question..?

サインインしてコメントする。

回答 (3 件)

Image Analyst
Image Analyst 2014 年 8 月 12 日
編集済み: Image Analyst 2014 年 8 月 12 日
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 2014 年 8 月 12 日
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 2014 年 8 月 12 日
x0 = reshape(X,2,[]);
x1 = [x0(1,:);-conj(x0(2,:))];
x2 = [x0(2,:);conj(x0(1,:))];
tX = [x1(:).';x2(:).'];
  1 件のコメント
Kishore
Kishore 2014 年 8 月 14 日
Thank u andrei bobrov this block should work within for loop ie i need to convert 1XN matrix to 2XN matrix using for loop

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by