How to tabulate?

9 Ansichten (letzte 30 Tage)
prem kumar
prem kumar am 29 Jan. 2022
Beantwortet: Voss am 29 Jan. 2022
hello friends i want to ask a question regarding tabulation of number of days and sdelta without the statistic toolbox.
dn=1:1:365;
x=(360/365*(dn+284));
sdelta=23.45*(sind(x)*pi/180);
Tabulate sdelta for dn = 15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345.
for normal tabulation for dn and sdelta is easy i believe but how about when the number of days is like this?i did thought about interpolation but i think it would not be that complicated and must have a simpler way to solve it ..can anyone give me a hint or guide me?.Thank you friends

Akzeptierte Antwort

KSSV
KSSV am 29 Jan. 2022
You can use interp1.
dn=1:1:365;
x=(360/365*(dn+284));
sdelta=23.45*(sind(x)*pi/180);
dni = [15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345] ;
sdeltai = interp1(dn,x,dni);
  1 Kommentar
prem kumar
prem kumar am 29 Jan. 2022
owh ok noted thank you friend.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Voss
Voss am 29 Jan. 2022
You do not need to interpolate because the dn values you want the sdelta for are all already in the vector of all dn values (i.e., 1:1:365 contains 15, 45, 75, ...); you merely need to take those indices of sdelta:
dn=1:1:365;
x=(360/365*(dn+284));
sdelta=23.45*(sind(x)*pi/180);
dni = [15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345];
sdeltai = sdelta(dni) % get elements of sdelta at indices dni
sdeltai = 1×12
-0.3712 -0.2377 -0.0422 0.1643 0.3280 0.4061 0.3783 0.2518 0.0597 -0.1480 -0.3171 -0.4035
isequal(sdeltai,interp1(dn,sdelta,dni)) % same as "interpolating"
ans = logical
1

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by