How to stock a vector in a vector
Mostrar comentarios más antiguos
Hello everybody !
I'm in trouble with this : I would like to change the value of water_u in my loop and to stock the result in X (a 3 colomns or 3 rows matrice).
It doesn't work... Can someone help me ? :)
Many thanks in advance
clear all
close all
clc
water_density = [0.997]; %[g/cm3]
water_att = [1.64e-1; 6.40e-2; 2.92e-2]; %[cm2/g] @100, 1000, 10000 keV
water_u = water_density.*water_att; %[cm-1]
R = rand(1,1000);
for i=1:3
X = -(log10(1-R)./water_u(i));
end
2 comentarios
Geoff Hayes
el 27 de Mzo. de 2020
Maxime - your R is a 1x1000 matrix. Is that correct? It seems that you are using a different value of water_u in your loop (good), but because of the size of R, the X can never be a 3x1 or 1x3 matrix.
Maxime Chapellier
el 27 de Mzo. de 2020
Editada: Maxime Chapellier
el 27 de Mzo. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!