Borrar filtros
Borrar filtros

Inputting a Matrix into a function

1 visualización (últimos 30 días)
Faith
Faith el 3 de Dic. de 2023
Movida: Torsten el 4 de Dic. de 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?

Respuestas (2)

VBBV
VBBV el 3 de Dic. de 2023
Editada: VBBV el 3 de Dic. de 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 el 4 de Dic. de 2023
Movida: Torsten el 4 de Dic. de 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)

Categorías

Más información sobre Surfaces, Volumes, and Polygons en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by