Histogram for a loop
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Geoff Hayes
le 15 Fév 2019
Chanaka - why do you expect to see a Gaussian type distribution? What do you see instead?
Réponses (0)
Voir également
Catégories
En savoir plus sur Histograms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!