How to stock a vector in a vector
Show older comments
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 Comments
Geoff Hayes
on 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
on 27 Mar 2020
Edited: Maxime Chapellier
on 27 Mar 2020
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!