Forums

why loop element numbers are different?

Started by Unknown July 26, 2010
Hi;
I couldn't find where the error is. Loop element numbers are more than
it must be. For example when;

handles.UppWaveLen = 1.53
handles.LowWaveLen = 1.57

loop must be between 6369:6536 and there must be 168 elements of the for
loop. But it writes in excel file 418 elements.
Could anyone help me to find the error. Thanks in advance.

k=1;

for i=floor(10000/handles.UppWaveLen):1:ceil(10000/handles.LowWaveLen)

a(k)=i;

k0(k)=2*pi/((10000*(1e-6)/i));

ro_0(k)=(0.545*((2*pi/((10000*(1e-6)/i)))^2)*(Cn2)*(handles.Distance))^(-3/5);

c1b(k)=((10000*(1e-6)/i)*handles.Distance/(2*pi*((handles.BeamRad)^2)))^2;

c1c(k)=((10000*(1e-6)/i)*handles.Distance/(1*pi*(handles.BeamRad)*(1e100)))^2;

c1d(k)=((10000*(1e-6)/i)*handles.Distance/(2*pi*(handles.BeamRad)*(handles.SpatCohLen)))^2;

c2b(k)=((10000*(1e-6)/i)*handles.Distance/(2*pi*((handles.BeamRad)^2)))^2;

c2c(k)=((10000*(1e-6)/i)*handles.Distance/(1*pi*(handles.BeamRad)*(ro_0(k))))^2;

%c2c(k)=((10000*(1e-6)/i)*handles.Distance/(1*pi*(handles.BeamRad)*(0.05)))^2;

c2d(k)=((10000*(1e-6)/i)*handles.Distance/(2*pi*(handles.BeamRad)*(handles.SpatCohLen)))^2;

TransCoeff(k)=(((c1a)+(c1b(k))+(c1c(k))+(c1d(k)))/((c2a)+(c2b(k))+(c2c(k))+(c2d(k))));

k=k+1;

end

handles.TransCoeff=(TransCoeff)';

[DosAdi1 DosYeri1] = uiputfile('*.xls','Iletim Katsayisini Kaydet');

if isequal(DosAdi1,0)

msgbox('Cancel"a bastiniz')

end

cd(eval(['DosYeri1']));

xlswrite(DosAdi1,handles.TransCoeff,'Transmisyon Katsayilari');

guidata(hObject, handles);

msgbox('Elde edilen yeni iletim katsayisi degerleri kaydedildi.');