私は分布を作成しようとしていますが、特定の条件に基づいていくつかのパーティクルを削除し、他のものを保持して、それらを行ベクトル形式に配置します。フィルタリングが完了したら、インデックスを介して左上の点の座標を保存します。インデックスから座標を抽出する
私の考えは、インデックスを使用して、条件を満たすposx、posy、poszの座標を抽出することでした。 私はこれを行うことができません。以下はコードです。すべての入力は役に立つ人になります。どんな簡単な方法であれ、最も役立ちます。 私はMatlabを初めて使っていますので、素直な質問を許してください。 ありがとう 。 。
clear all;
%=============Minimum Allowable Distance/Blockade Radius=====================
blockade = 15*10^-6;% blockade radius in um
%=============Sigma of the RED LASER beam from the SLM=====================
sigmax = 10;% 1-sigma x of the SLM beam in um
sigmay = 10;% 1-sigma y of the SLM beam in um
%=============Sigma of the BLUE LASER beam from the SLM====================
sigmaz = 10;% sigma z of the blue beam in um
%==================Number of Scan Steps====================================
npics =500; %number of iterations
%=============Number of initial particles in the excitation volume in the MOT Stage===================
numberofparticles = 100; % Number of points per iteration
%=============Creating a cell system for importing GPT Data into===========
l = cell(numberofparticles,1);
distances = cell(npics,1);
posx = cell(npics,1);
posy = cell(npics,1);
posz = cell(npics,1);
for n=1:1:npics
fprintf(' %d ', n);
%----------------------------------------------------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SECTION 1: Creating Distributions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------------------------------------------
%============Declaration of orgin for simulation===========================
mux = 0;
muy = 0;
muz = 0;
%=============Creating a x,y,z coordinate system for the ion===============
x = normrnd(mux,sigmax*10^-6,[1 numberofparticles]);
y = normrnd(muy,sigmay*10^-6,[1 numberofparticles]);
z = normrnd(muz,sigmaz*10^-6,[1 numberofparticles]);
%%%%%%%%%%%%%METHOD 2%%%%%%%%%%%%%%%%
for i = 1:1:length(l)
for j = 1:1:length(l)
distances{i}{j} = sqrt((x(i) - x(j)).^2 + (y(i) - y(j)).^2 + (z(i) - z(j)).^2);
if distances{i}{j} < blockade
distances{i}{j} = 0;
end
if distances{i}{j} >= blockade
posx{j} = x(j);
posy{j} = y(j);
posz{j} = z(j);
end
end
end
end
npics、length(l)とblockageとは何ですか?あまりにも多くの未知の変数があるので、私たちはコードを実行することはできません。あなたは私たちにいくつかの情報をもっと与える必要があります。 – 10a
blockade = 15 * 10^-6%normallndによって作成された2点最小標準距離 sigmax = 10; SLMビームの%1-sigma x sigmay = 10; SLMの%シグマy梁内のビーム sigmaz = 10; um内の青色ビームの%シグマz npics = 2;繰り返し数% パーティクル数= 100; l =セル(粒子数、1); 距離=セル(npics、1); posx = cell(npics、1); posy =セル(npics、1); posz = cell(npics、1); – Tarun
あなたの質問をコード全体で編集してください。編集ボタンはあなたの投稿の左下にあります。 – 10a