# Find data in specific range

1 visualizzazione (ultimi 30 giorni)
Ahmad Rizal il 31 Dic 2011
Dear all,
I'm quite new in using Matlab. I've wrote a script to determine estimation of solar declination, sd by day number, dn. I would like to know how I can find and fprintf on which dn when -0.2<= sd <= 0.2 with script below. Please help me
fout = fopen('Project_2_Matlab.res','w');
% day number, dn
dn = [1:1:365];
% Solar declination, sd
sd = 23.45*sind(360*(dn+284)/365);
for i=1:1:36
j=i*10;
fprintf(fout,'%3d %3.3f \n',j, sd(j));
end
##### 0 CommentiMostra -1 commenti meno recentiNascondi -1 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Andrei Bobrov il 31 Dic 2011
out = dn(sd >= -.2 & sd <= .2);
##### 1 CommentoMostra NessunoNascondi Nessuno
Ahmad Rizal il 31 Dic 2011
Thanks Andrei, it worked.

Accedi per commentare.

### Più risposte (1)

Jose Jeremias Caballero il 31 Dic 2011
Hi.
clear all
dn = 1:365;
sd = 23.45*sind(360*(dn+284)/365);
fout1 = fopen('Project_2_Matlab.res','w');
fprintf(' i dn(i) sd(i)\n');
for i=1:length(sd)
if sd(i)>=-0.2 && sd(i)<=0.2
fprintf(fout1,'%3d %3d %6.3f\n',i,dn(i),sd(i));
end
end
fclose(fout1);
type Project_2_Matlab.res
EXECUTION.
>> Untitled7
i dn(i) sd(i)
81 81 0.000
##### 0 CommentiMostra -1 commenti meno recentiNascondi -1 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Solar Power 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