Histogram for a loop
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I am trying to simulate a chromatogram for 100 molecules using following code and the output looks very strange. What I am expecting is a Gaussian type distribution.
TP=10000; %number of total theoritical plates
N=100; %number of molecules
Pa=0.11; %partition coefficient of A (mobile/stationary)
Pb=0.12; %partition coefficient of B (mobile/stationary)
%This part simulates the retention time for A
tA=zeros(N,1);
for i=1:N %for loop for N number of molecules
NTPa=0; %# of theoritical plates before equilibration
while NTPa<TP; %number of TPs for A should never exceed total number of TPs.
if rand(1,1)>Pa; %partition coefficient of A
NTPa=1+NTPa;
tA(i)=(1+NTPa)*0.01; %tA=retention time of A
end
end
end
%This part simulates the retention time for B
tB=zeros(N,1);
for i=1:N %for loop for N number of molecules
NTPb=0; %# of theoritical plates before equilibration
while NTPb<TP;
if rand(1,1)>Pb; %partition coefficient of B
NTPb=1+NTPb;
tB(i)=(1+NTPb)*0.01; %tB=retention time of B
end
end
end
subplot(2,1,1);hist(tA/60); %conversion to minutes
xlabel('retention time (min)')
ylabel('Signal (arbitary units)')
title('chromatogram A')
subplot(2,1,2);hist(tB/60); %conversion to minutes
xlabel('retention time (min)')
ylabel('Signal (arbitary units)')
title('chromatogram B')
댓글 수: 2
Geoff Hayes
2019년 2월 15일
Chanaka - why do you expect to see a Gaussian type distribution? What do you see instead?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!