Inputting a Matrix into a function

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?

Antworten (2)

VBBV
VBBV am 3 Dez. 2023
Bearbeitet: VBBV am 3 Dez. 2023

0 Stimmen

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 am 4 Dez. 2023
Verschoben: Torsten am 4 Dez. 2023

0 Stimmen

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)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 3 Dez. 2023

Verschoben:

am 4 Dez. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by