Page 1 of 1

Ripples in Simulation

Posted: Fri Nov 22, 2024 8:36 am
by riley22

Hello, I am currently using the pepper function to simulate a two component powder spectra. I have noticed that the simulation has pretty severe rippling in it. Per the user guide, I tried increasing the gridsize, but this doesn't really seem to help. I have included pictures of gridsizes of 19, 181, and 300. Included below is the script that I have. I was wondering if there was anything in the script that I might be missing that is inducing these ripples, since I am still new to EasySpin. I appreciate any insights on the matter!

clear
clc

Data = dlmread('file.txt', '\t', 1, 0);
B = Data(:, 1);
spc = Data(:, 2);
B = B(1:6000);
B = B/10;
spc=spc(1:6000);
Exp.CenterSweep =[320 600];
Exp.mwFreq = 9.353809;
Exp.nPoints = 6000;
Exp.ModAmp = 1;
Exp.Temperature = 10;

%Component 1
Sys0.S = 1/2;
Sys0.g = [5.75686557613257 5.58321373597561 1.99275217276477];
Sys0.lwpp = 2.14278494187109; %in mT 1.82172230612951
Sys0.HStrain = [423.142628549750 878.265239790310 11.4491219726372];
%Sys0.gStrain=[0 0.1 0];

SysVary0.g = [0.1 0.1 0.1];
SysVary0.HStrain = [150 180 50];
%SysVary0.gStrain=[0.18 0.043 0];
SysVary0.lwpp = 5;

%Component 2
Sys1.S = 1/2;
Sys1.g = [2.61766621912696 2.23007773414852 1.80619903241103];
Sys1.lwpp = 1.47293212084371;
Sys1.HStrain = [174.251758070979 39.2686298569257 157.628563641514];

SysVary1.g = [0.1 0.1 0.1];
SysVary1.HStrain = [10 10 10];
SysVary1.lwpp = 1;

%Weight each system in the spectra
Sys0.weight = 135;
Sys1.weight = 82;

SysVary0.weight = 15;
SysVary1.weight = 15;

FitOpt.Scaling = 'minmax';
Opt.GridSize = 181;

[Bsim,spcsim] = pepper({Sys0,Sys1},Exp);
plot(B,spc,Bsim,spcsim*11);
esfit(spc,@pepper,{{Sys0,Sys1},Exp},{{SysVary0,SysVary1}});


Re: Ripples in Simulation

Posted: Sun Nov 24, 2024 2:39 am
by thanasis

What happens if you entirely remove Exp.ModAmp = 1 from the experimental parameters?


Re: Ripples in Simulation

Posted: Thu Jan 23, 2025 10:25 pm
by Stefan Stoll

Your Sys0 is very anisotropic and has a very narrow linewidth, particularly around the z axis. This will lead to ripples if your grid is too small. See here:

Code: Select all

clear, clc

Exp.CenterSweep = [320 600];  % mT
Exp.mwFreq = 9.353809;  % GHz
Exp.nPoints = 2000;
Exp.ModAmp = 1;  % mT
Exp.Temperature = 10;  % K

Sys0.S = 1/2;
Sys0.g = [5.76 5.58 1.99];
Sys0.lwpp = 2.1; % mT
Sys0.HStrain = [423 878 11];

Opt.GridSize = [19 4];  % equal to the default values
[B,spc1] = pepper(Sys0,Exp); 
Opt.GridSize = [31 4];
[B,spc2] = pepper(Sys0,Exp,Opt); 

plot(B,spc1,B,spc2)

You can eliminate the ripples by increasing Opt.GridSize, often substantially.

You can also increase the linewidth, but that might not be possible given your experimental spectrum.

Also, in general it is recommended not to use Sys.lwpp and Sys.HStrain at the same time.