Page 1 of 1

Error while exporting data

Posted: Thu Apr 21, 2016 1:01 am
by Abbey Philip
Dear all,
I'm trying to simulate the EPR spectrum for a radical pair using pepper. The error seems to appear while exporting the data in ascii format. The code and the error is as follows.

Code: Select all

clear

%Experimental spectrum
[B,spc] = eprload('PA_exp');

%Spin A:
SysA.S = 1/2;
SysA.g = 2.0099;
SysA.Nucs = '1H,1H,1H,1H,1H';
SysA.weight = 100.85;
SysA.A = mt2mhz([14.5,14.5,14.5,14.5,14.5]/10);
SysA.lwpp = [1.30 0.015];
VaryA.g = [0.05];
VaryA.A = [1];

%Spin B:
SysB.S = 1/2;
SysB.g = 2.0088;
SysB.Nucs = '1H,1H,1H,1H,1H';
SysB.weight = 100.85;
SysB.A = mt2mhz([14.5,14.5,14.5,14.5,14.5]/10);
SysB.lwpp = [1.25 0.015];
VaryB.g = [0.05];
VaryB.A = [1];

%Defining the two spins together:
Sys = {SysA SysB};
Vary = {VaryA VaryB};

%Experimental details:
Exp.mwFreq = 9.137; %Experimental freq
Exp.mwPhase = 3*pi/180;
Exp.Range = [310.569 339.9945]; %data point range
Exp.nPoints = 64293; % number of data points
Exp.ModAmp = 0.15; %in mT
Exp.Temperature = 80; %in Kelvin
Exp.Mode = 'perpendicular';
B = linspace(Exp.Range(1),Exp.Range(2),Exp.nPoints); % field axis

% Next, we specify which parameter we want to be fitted
% and by how much the fitting algorithm can vary it approximately.
% Calling the fitting function
SimOpt.Method = 'perturb2';
FitOpt.Method = 'simplex int'; % simplex algorithm, integrals of spectra
[spc,fitparams] = esfit('pepper',spc,Sys,Vary,Exp);
data = [B(:) spc(:)];
save('myfile.txt','data','-ascii');
The error

Code: Select all

Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Error in PAsimc_A (line 46)
data = [B(:) spc(:)];
I kindly request all to help me solve the error.

Thanks and regards,
Abbey

Re: Error while exporting data

Posted: Thu Apr 21, 2016 8:53 am
by thanasis
Maybe try:

Code: Select all

[fitparams,spc] = esfit('pepper',spc,Sys,Vary,Exp);
Does that work?

Re: Error while exporting data

Posted: Thu Apr 21, 2016 9:14 am
by Abbey Philip
Thanks you sir. That change seem to work and the file is exported as ascii.

One more thing, The simulated spectrum is seen in output window, however I'm not seeing the experimental spectrum with the simulation data.

Is it possible that I can get simulated and experimental spectrum in the same output window after the simulation is over, so that I can compare the simulation data with the experimental one.

Please help if possible.

Thanks and regards,
Abbey

Re: Error while exporting data

Posted: Thu Apr 21, 2016 10:24 am
by thanasis
I have only used it in an either/or scenario (graphical output / ascii file), but I don't know if that's the only way.

Re: Error while exporting data

Posted: Thu Apr 21, 2016 9:48 pm
by Abbey Philip
Thanks for the reply.

The exporting to ascii is troubleshooted as per your advise.

Actually I was mentioning about the graphical output in the previous query. I want to see the experimental and the simulation data in the matlab graphical output. However, I'm seeing only the simulation data in the graphical output at present.

Is it possible that I can visualise both the simulation and experimental data together in the graphical output after the simulation is completed?

Thanks and regards,
Abbey