Component Separation from two component EPR spectrum

General forum for EasySpin: questions, how to's, etc.
Post Reply
Shamiul41
Newbie
Posts: 3
Joined: Mon Nov 11, 2024 8:02 pm

Component Separation from two component EPR spectrum

Post by Shamiul41 »

Hi, I am new user. I tried to fit two component epr spectrum. And I fitted the spectrum. but i am unable to separate the component. I used the following code to fit the data. can anyone please help me what coding instruction i need to apply to save the component separately? or what is the output file of fitted spectrum for two component? Please help me.
% Load experimental data
[filename,filepath] = uigetfile('*.txt','Open experimental data to fit');
path = [filepath,filename];
[B, spc] =textread(path)
figure;
plot(B, spc);
%%
Sys1.g = [2.0072, 2.0062, 2.0033];
Sys1.A=[6.7 6.7 37];
Sys1.Nucs = '14N';
Sys1.weight =40;
Sys1.lwpp = 0.1; % mT
Sys2.g = [2.0072, 2.0062, 2.0033];
Sys2.A=[6.7 6.7 37];
Sys2.weight = 60;
Sys2.Nucs = '14N';
Sys2.lwpp =0.15; % mT
Sys1.logtcorr =-8.9;
Sys2.logtcorr =-7.6;
Exp.mwFreq = 9.5; % GHz
Exp.Range = [336.6 340.3]; % mT
Exp.nPoints = 2048;
Sys = {Sys1,Sys2};
Vary1.g = [0.009, 0.009, 0.009]; % Check if this g-tensor is correct for your system
Vary1.A = [1 1 1.5]; % Check if hyperfine values are reasonable
Vary2.g = [0.009, 0.009, 0.009];
Vary2.A=[1 1 1.5];
Vary1.weight=20;
Vary2.weight =20;
Vary1.lwpp = 0.1; % Ensure line width is set correctly
Vary2.lwpp = 0.1; % Allow more variation for Sys2
Vary1.logtcorr =1;
Vary2.logtcorr =1;
Vary = {Vary1, Vary2};
FitOpt.maxTime = '30'; % Allow up to 30 minutes for Stage 1
FitOpt.TolEdgeLength = 1e-3; % Relax tolerance
Options.LLMK = [50000, 25000, 1000, 5000];
Options.maxIter = 10000; % Allow for 50,000 iterations as a test

% Run the fitting process
result=esfit(spc, @chili, {Sys, Exp, SimOpt}, {Vary}, FitOpt);
figure;
subplot(2, 1, 1);
plot(B, spc,'b-', 'DisplayName', 'Original Spectrum');
hold on;
plot(B,result.fit,'r', 'DisplayName', 'Fitted Spectrum');
xlabel('Magnetic Field (mT)');
ylabel('Signal');
title('Original Spectrum with Fitted Spectrum');
legend('show');
Residual = spc-result.fit;
subplot(2, 1, 2);
plot(B, Residual, 'g-');
xlabel('Magnetic Field (mT)');
ylabel('Signal');
title('Residual Spectrum');
data1 = [B(:) result.fit(:)];
save('Fitted Spectrum 126 2.txt','data1','-ascii');
data2 = [B(:) Residual(:)];
save('Residual 126 2.txt','data2','-ascii');

Attachments
NB5_126_2 fitted spectrum.png
NB5_126_2 fitted spectrum.png (43.81 KiB) Viewed 14299 times
katarkon
Local Expert
Posts: 212
Joined: Mon Jan 12, 2015 4:01 am

Re: Component Separation from two component EPR spectrum

Post by katarkon »

You may extract each parameter set from the output and simulate them separately.

Post Reply