Effacer les filtres
Effacer les filtres

Inputting a Matrix into a function

1 vue (au cours des 30 derniers jours)
Faith
Faith le 3 Déc 2023
Déplacé(e) : Torsten le 4 Déc 2023
I'm trying to calculate the kernel coefficient for volume scattering by inputting a range of values for t1r and g into my kvol variable.
how would i create a matrix for kvol that is in terms of my other matrices, t1r and g?

Réponses (2)

VBBV
VBBV le 3 Déc 2023
Modifié(e) : VBBV le 3 Déc 2023
t0 = 0.5235;
t1d = 0:60;
t1r = deg2rad(t1d);% use this function to convert to radians
phi = pi;
g = cos(t0)*cos(t1r) + sin(t0)*sin(t1r)*cos(phi)
g = 1×61
0.8661 0.8572 0.8481 0.8387 0.8291 0.8192 0.8091 0.7987 0.7881 0.7772 0.7661 0.7548 0.7432 0.7314 0.7194 0.7072 0.6947 0.6821 0.6692 0.6561 0.6429 0.6294 0.6157 0.6019 0.5879 0.5737 0.5593 0.5447 0.5300 0.5151
kvol = ((0.5*pi-g).*cos(g)+sin(g))./(cos(t0)+cos(t1r)) - (pi/4)
kvol = 1×61
-0.1325 -0.1299 -0.1271 -0.1241 -0.1209 -0.1175 -0.1139 -0.1101 -0.1061 -0.1019 -0.0975 -0.0929 -0.0881 -0.0831 -0.0778 -0.0724 -0.0668 -0.0609 -0.0549 -0.0486 -0.0421 -0.0354 -0.0286 -0.0215 -0.0142 -0.0067 0.0010 0.0090 0.0171 0.0254
plot(kvol)

Torsten
Torsten le 4 Déc 2023
Déplacé(e) : Torsten le 4 Déc 2023
Use
kvol = (((0.5*pi-g).*cos(g)+sin(g))./(cos(t0)+cos(t1r))) - pi/4
instead of
kvol = (((0.5*pi-g)*cos(g)+sin(g))/(cos(t0)+cos(t1r))) - (pi/4)

Catégories

En savoir plus sur Surfaces, Volumes, and Polygons dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by