Pearson correlation coefficient determination
Afficher commentaires plus anciens
Hi,
I am trying to generate the Pearson correlation coefficient for A1 vs. A2, A1 vs. C and A2 vs. C. For all these I get 1.000 which is quite unrealistic. What am I doing wrong here? You can use these numbers to excute the function. Pearson_correlation(100000,10000,25000,1)
function [ Absorbance1,Absorbance2 ] = Pearson_correlation(I0,E1,E2,l)
% A = ECl beer-lambert law
% A = -log T = -log(It/Io)=log(I0)-log(It)
% A = Absorbance
%It = Intensity of Transmitted photons
%I0 = Initial Intensity of photons
C=[0 10 20 30 40 50]; %Concentrations
C1=C*1E-6; %Concentration unit conversion
SD=sqrt(I0); %Standard deviation of excitation photons
%This part of the code generates numbers for A1,A2 and the Pearson
%correlation coeffienct for A1 vs. A2, A1 vs. C and A2 vs.C
I0f=I0+randn(1,1).*SD; %excitation photon fluctuation
A1=E1*C1*l; %Calculation of absorbance
It11=I0f.*10.^(-A1); %Calculation of transmittance
SD21=sqrt(It11);
It12=It11+SD21.*randn(1,1); %transmittance fluctuation
Absorbance1=log(I0f)-log(It12) %calculation of absorbance accounding the fluctuations.
I0f=I0+randn(1,1).*SD; %excitation photon fluctuation
A2=E2*C1*l;
It21=I0f.*10.^(-A2);
SD21=sqrt(It21);
It22=It21+SD21.*randn(1,1);
Absorbance2=log(I0f)-log(It22)
r=corrcoef(Absorbance1, Absorbance2);
Absorbance_correlation=r(2)
s=corrcoef(C,Absorbance1);
Concentration_correlation1=s(2)
t=corrcoef(C,Absorbance2);
Concentration_correlation2=t(2)
% Pearson_correlation(100000,10000,25000,1)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Chemistry dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!