Temporary save an output

2 Ansichten (letzte 30 Tage)
Chanaka Navarathna
Chanaka Navarathna am 13 Feb. 2019
Hi,
I am trying to run this code to get a correlation between Absorbance1 and Absorbance2, but it gives 1.000 and doesn't make any sense. I think I am doing it wrong and I want to try temporary saving the outputs of Absorbance1 and Absorbance 2 and call for correlation. How do I accomplish this?
function [ Absorbance1,Absorbance2 ] = Pearson_correlation(I0,E1,E2,l)
% Detailed explanation goes here
% 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)
% Pearson_correlation(100000,10000,25000,1)

Antworten (0)

Kategorien

Mehr zu Microelectronics, Photonics and Nanotechnology finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by