Index in position 1 exceeds array bounds (must not exceed 995)
5 次查看(过去 30 天)
显示 更早的评论
I am trying to plot a TARC and CCL of my MIMO antenna but am getting this errors
> TARC
Index in position 1 exceeds array bounds (must not exceed 995).
Error in TARC (line 23)
S12a=10^(S12(j,2)/20);
Below is the code
%%
%'txt'
S11=dlmread('Mode 1 S11.txt','',2,0);
S12=dlmread('Mode 1 S12.txt','',2,0);
S21=dlmread('Mode 1 S21.txt','',2,0);
S22=dlmread('Mode 1 S22.txt','',2,0);
freq=S11(:,1);
theta=0:30:180;
na = length (S11);
n = length (theta);
Ta = zeros (na,n+1);
Ta(:,1) = freq;
Taa(:,1) = freq;
for i = 1 : n
th = theta (i);
for j = 1 : na
% if the value of Aa is read from a .txt file (db), you would need to
% convert it to s2p. format (i.e magnitude) as follows;
S11a=10^(S11(j,2)/20);
S12a=10^(S12(j,2)/20);
S21a=10^(S21(j,2)/20);
S22a=10^(S22(j,2)/20);
Ta(j,i+1) = sqrt(((abs(S11a+S12a.*exp(complex(0,1)*th)))^2 + ...
(abs(S21a+S22a.*exp(1i*th)))^2))/sqrt(2);
Taa(j,i+1) = 20*log10(Ta(j,i+1));% Converting values back to db
% Ta(j,i+1) = sqrt(((abs(Aa(j,2)+Aa(j,6).*exp(complex(0,1)*th)))^2 + ...
% (abs(Aa(j,8)+Aa(j,4).*exp(complex(0,1)*th)))^2))/sqrt(2);
% Taa(j,i+1) = 20*log10(Ta(j,i+1));% Converting values to db
% Ta(:,i+1) = sqrt(((abs(S11(:,2)+S12(:,2)*exp(1i*th(i)))).^2 + ...
% (abs(S21(:,2)+S22(:,2)*exp(1i*th(i)))).^2))/sqrt(2);
end
end
%%
figure()
plot(freq,Taa(:,2),'-k');
hold
plot(freq,Taa(:,3),'-.b');
plot(freq,Taa(:,4),'.r');
plot(freq,Taa(:,5),':c');
plot(freq,Taa(:,6),'--g');
plot(freq,Taa(:,7),'-m');
dlmwrite('7.txt',Taa,'delimiter','\t')
0 个评论
回答(4 个)
Walter Roberson
2019-9-29
na = length (S11);
length() is defined as 0 if the object has any dimension of size 0, and otherwise length is defined as the largest dimension. If a file had 1000 columns and 995 rows, then its length() would be 1000, and trying to iterate to that row number would be a failure.
You should only use length() with something you know to be empty or scalar or a vector; otherwise you should use size() with the appropriate dimension number.
2 个评论
KALYAN ACHARJYA
2019-9-29
Walter sir comment goes here
"Specify the column offset as 0 (I think it reads the 1 column only), as 0,0 offsets read the first element only."
No, notice the documentation says "starts reading".
Row offset 2 means that it skips two header lines before trying to read numeric data. Column offset 0 means it skips 0 columns out of each line.
There is no problem with those lines, provided that the user really does have exactly two header lines to skip.
Adamu Halilu Jabire
2019-9-29
2 个评论
Kolangiammal S
2020-2-15
Dear mam, thhe following plots use MATLAB code...getting S parameter and different parameters from cst tool.if u have any idea kindly share 1.Envelope corrlate coefficient 2.channel capacity loss ( CCL) 3.mean effective gain 4.multiplexing efficiency Thanks in advance
Walter Roberson
2020-2-16
If you had asked a new Question when I had suggested two weeks ago, possibly you would have had a response by now. People are not expecting discussion of that topic in this Question about index out of range.
Kolangiammal S
2020-2-3
Dear sir, Good evening. I am working in UWB antenna design. In that I need to plot the following plots use MATLAB code...getting S parameter and different parameters from cst tool.if u have any idea kindly share 1.Envelope correlate coefficient 2.channel capacity loss ( CCL) 3.mean effective gain 4.multiplexing efficiency Thanks in advance
1 个评论
Walter Roberson
2020-2-4
You should ask a new Question on this topic.
SAROSH AHMAD
2021-11-30
How are you doing>?
Can you also share the Matlab code or way to calculate CCL of the MIMO?
I will be very grateful to you.
Thanks in Advance
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Array Geometries and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!