help!! Error:In an assignment A(I) = B, the number of elements in B and I must be the same.

1 次查看(过去 30 天)
clear all;
close all;
L_0=10; %Average outer scale of turbulance in m.
c_n=5*10^(-12); %Structure constant of refractive index in m^-2/3.
c=300000000; % Speed of light in m/s.
f=20*10^9; % Frequency in HZ.
lamda=c/f;
L=100:100:5000;%Equivalent Path length through the turbulence area
%del_ky=0.01;
for i=length(L)
sigma(i)=((0.307*(c_n)^2)*((2*3.1416/lamda)^(1.17))*(L.^(1.833)))-((0.742*(c_n)^2)*((2*23.1416/lamda)^(0.17))*((L.^(2.833))*(L_0^2)))
end
semilogy(sigma,L)

采纳的回答

Star Strider
Star Strider 2016-2-1
You can do this using ‘vectorised’ code without the loop:
L_0=10; %Average outer scale of turbulance in m.
c_n=5*10^(-12); %Structure constant of refractive index in m^-2/3.
c=300000000; % Speed of light in m/s.
f=20*10^9; % Frequency in HZ.
lamda=c/f;
L=100:100:5000;%Equivalent Path length through the turbulence area
%del_ky=0.01;
sigma = ((0.307*(c_n)^2)*((2*3.1416/lamda)^(1.17))*(L.^(1.833)))-((0.742*(c_n)^2)*((2*23.1416/lamda)^(0.17))*((L.^(2.833))*(L_0^2)));
semilogy(sigma,L)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by