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에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by