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

1 visualizzazione (ultimi 30 giorni)
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)

Risposta accettata

Star Strider
Star Strider il 1 Feb 2016
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)

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by