📄 co4.m
字号:
function [st, st_rate]=co4(x1, x2, x3);
%Get the complex orthogonal matrix.
%x1, x2, x3 can be vectors.
if nargin~=3,
disp('[co4]Error: Three inputs are required.');
return;
end
if size(x1, 1)>1 && size(x1, 2)>1 | size(x2, 1)>1 && size(x2, 2)>1 | size(x3, 1)>1 && size(x3, 2)>1,
disp('[co4]Error: Input should be vectors.');
return;
end
if [length(x1), length(x2), length(x3)]/length(x1)~=ones(1, 3);
disp('[co4]Error: All input vector should have the same length.');
return;
end
%make x1 and x2 vectors.
if size(x1, 2)>1,
x1=x1.';
end
if size(x2, 2)>1,
x2=x2.';
end
if size(x3, 2)>1,
x3=x3.';
end
%dimension of the space-time code
%p is the number of inputs for a block per transmitter
%q is the number of outputs for a block per transmitter
%space_len is the number of transmitters
space_len=4;p=3;q=4;
time_len=q*length(x1);
%rate of the orthogonal codes.
st_rate=p/q;
%construct Alamouti matrix.
st=zeros(time_len, space_len);
index1=1:q:time_len;
index2=index1+1; index3=index2+1; index4=index3+1;
st(index1, :)=[x1 x2 0 x3];
st(index2, :)=[-conj(x2) conj(x1) x3 0];
st(index3, :)=[0 -conj(x3) x1 conj(x2)];
st(index4, :)=[-conj(x3) 0 -x2 conj(x1)];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -