How to tabulate?

9 ビュー (過去 30 日間)
prem kumar
prem kumar 2022 年 1 月 29 日
回答済み: Voss 2022 年 1 月 29 日
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

採用された回答

KSSV
KSSV 2022 年 1 月 29 日
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 件のコメント
prem kumar
prem kumar 2022 年 1 月 29 日
owh ok noted thank you friend.

サインインしてコメントする。

その他の回答 (1 件)

Voss
Voss 2022 年 1 月 29 日
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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by