我正在尝试使用Matlab评估参数,这是代码
miu_not=1.257*1e-6; % permeability of free space
efslon_not=8.854*1e-12;% permittivity of free space
efslon_rg=input('Enter the relative permittivity of ground ')
segma_g=input('Enter the ground conductivity') ;
b=input('enter the conductor radius');
f= input('Enter the frequency');
w=2*pi*f;
prop_ground=sqrt(1i*w*miu_not(segma_g+(1i*w*efslon_not*efslon_rg)))
它给出了一个关于最后一行的索引的错误,它必须是正数或逻辑,而我在等式中没有任何数组???
确切的错误消息是:
Array indices must be positive integers or logical values.
Error in Untitled (line 8)
prop_ground=sqrt(1i*w*miu_not(segma_g+(1i*w*efslon_not*efslon_rg)))
答案 0 :(得分:1)
在你的上一次发言中
prop_ground=sqrt(1i*w*miu_not(segma_g+(1i*w*efslon_not*efslon_rg)))
是否应该在miu_not和segma_g之间有一个运算符? 我认为它正在评估miu_not(%number%),所以Matlab认为你试图用数字来索引miu_not。