필터 지우기
필터 지우기

How to store complex data into an array using a For loop?

조회 수: 2 (최근 30일)
J
J 2018년 7월 16일
답변: James Tursa 2018년 7월 17일
I am trying to store data that contains complex numbers into an array. I am having issues on how to setup the loop and extract the data. The error I am getting says "Subscript indices must either be real positive integers or logicals" which is in code line 12.
i=1;
for k=10e-10:0.01:10 %discrete reduced frequency range
Ck = (besselh(1,2,k))./(besselh(1,2,k)+1i*besselh(0,2,k)); %Bessel function
%Matrices
A=[0.8132 -0.1008; -0.0725 2.0518];
B=Ck*[7.623 57.15; -8.233 -57.157];
C=Ck*[1865 1473.14; -1119 11907.48];
%frd function
Hresp=frd(Abar,k);
H11(i)=Hresp;
i=i+1;
end
I would like my output data to look like this:

채택된 답변

James Tursa
James Tursa 2018년 7월 17일
Type this at the MATLAB prompt:
dbstop if error
Then run your code. When the error occurs, the code will pause with all current variables intact. Examine them to figure out why the index you are using is not what you expected it to be.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by