Plot random points only in certain angles?

1 Ansicht (letzte 30 Tage)
Delshad Ayoubi
Delshad Ayoubi am 20 Dez. 2019
Kommentiert: Star Strider am 20 Dez. 2019
I have an alpha emitting source placed on the left side of a tumor cell. I want the emissions to be anisotropic, all of the alpha particles entering the cell (or at least only counting them). I'm not sure how to do this in my code. In the first For-loop I am plotting the random decay paths and it looks spherical. I want it to be anisotropic, aiming at a cell to the right. My assumption is to create an If-loop or something in order to exclude certain angles but I'm not sure how to.
clear; clc ;close all; format long
% ------------------ DIRECTIONS OF ALPHA PARTICLES -------------------- %
% Here, the sources At-211 are assumed to have alpha decays pointing into many
% different directions just like plot3(u,v,w,'.') illustrates.
% The centre of the figure is the source and the dots are the different
% directions? We assumed the At-211 source to be at (R,0,0), left of the
% spherical cell. They then decay as shows by the dots, in every direction.
% Problem: We want to exclude decays NOT leading into the cell.
% Discriminate against certain angles or directions?
n = 1000; % Number of iterations, random points.
phi = zeros(n,1); % Values from for-loop put here.
theta = zeros(n,1); % Values from for-loop put here.
for i = 1:n % Iterates the random angles and length of the directions and stores above in phi, theta and s.
phi(i,1) = rand*2*pi; % Uniform, same sampling everywhere in the horizontal axis.
theta(i,1) = acos(1-2*rand); % Not uniform. More points need to be sampled in the middle than the poles.
end
u = sin(theta(:,1)).*cos(phi); % Spherical coordinate for all points. "X"
v = sin(theta).*sin(phi); % Spherical coordinate for all points. "Y"
w = cos(theta); % Spherical coordinate for all points. "Z"
l = [u v w]; % This defines the direction of alpha particles. "[x,y,z]" for each.
figure
plot3(u,v,w,'.')
% --------------------------------------------------------------------- %
% ------------------- INTERSECTION OF ALPHA WITH CELL ----------------- %
% Here, the intersections for each alpha particle is calculated in a
% spherical geometry representing the cell that is irradiated.
R = 18e-6; % Radius of sphere.
c = [0,0,0]; % Center point of sphere.
o = [R,0,0]; % Assumed all At-211 to start in the left side of sphere. Origin of the line.
d1 = zeros(1,n);
d2 = zeros(1,n);
for k = 1:n
d1(1,k) = -(dot(l(k,:),o-c)) + sqrt((dot(l(k,:),o-c)).^2 - (norm(o-c))^2 + R^2); % Distance "1" from start "o".
d2(1,k) = -(dot(l(k,:),o-c)) - sqrt((dot(l(k,:),o-c)).^2 - (norm(o-c))^2 + R^2); % Distance "2" from start "o".
% This gives us the distance to intersection for each alpha
% particle.
end
% --------------------------------------------------------------------- %

Antworten (1)

Star Strider
Star Strider am 20 Dez. 2019
I have no idea what angles you want to restrict.
Assuming ‘phi’, add these assignments:
sel_phi = (phi > 0.1) & (phi < 0.5); % Include These ‘phi’ Values
phi(~sel_phi) = NaN; % Set Others To NaN
Inserting these assignments in this part of the code:
for i = 1:n % Iterates the random angles and length of the directions and stores above in phi, theta and s.
phi(i,1) = rand*2*pi; % Uniform, same sampling everywhere in the horizontal axis.
theta(i,1) = acos(1-2*rand); % Not uniform. More points need to be sampled in the middle than the poles.
end
sel_phi = (phi > 0.1) & (phi < 0.5); % Include These ‘phi’ Values
phi(~sel_phi) = NaN; % Set Others To NaN
u = sin(theta(:,1)).*cos(phi); % Spherical coordinate for all points. "X"
v = sin(theta).*sin(phi); % Spherical coordinate for all points. "Y"
w = cos(theta); % Spherical coordinate for all points. "Z"
Supply the correct angle range, and add (or substitute) similar restrictions on ‘theta’, depending on the result you want.
  2 Kommentare
Delshad Ayoubi
Delshad Ayoubi am 20 Dez. 2019
Bearbeitet: Delshad Ayoubi am 20 Dez. 2019
I basically want to reduce variance as illustrated by the image below. Essentially collimating the alpha particle emissions into the cell and then count on the particles entering as opposed to doing the same with isotropic (spreading equally in all directions, spherical).
The object in the middle being the cell (spherical) and the object above being the source emitting alpha particles. It's in 3D. I have a hard time separating the angles, tried to use IF statements but it didn't work.
Star Strider
Star Strider am 20 Dez. 2019
I do not understand what your code does, or what changes it needs in order to do what you want it to do.
Separating the angles most likely requires logical indexing of the sort my code does. You can use it as an example.
Is the sphere it currently plots the target, the source, or something else?
How does it fit into the context of the image in Skärmklifepp.PNG?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by