How to stock a vector in a vector
Afficher commentaires plus anciens
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 commentaires
Geoff Hayes
le 27 Mar 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
le 27 Mar 2020
Modifié(e) : Maxime Chapellier
le 27 Mar 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!