%Fitting Sabaris Iron intermediate script %% clear, clc, clf [B_G,spc]=textread('intermediate.dat','%f %f','headerlines',3); B = B_G/10; % convert field values from gauss to millitesla %plot(B,spc); Exp.mwFreq=9.5; i %GHz Exp.Range = [min(B) max(B)]; % use min and max for the simulation/fit Exp.nPoints = numel(B); % number of field points Sys0.Nucs = 'Fe'; % define the nucleus Sys0.A = [0]; % hyperfine coupling Sys0.g = [1.9823 2.1592 2.2165];% g-tensors %Sys0.lwpp = 4; % linebroadening; mT Sys0.gStrain = [0.0341 0.0682 0.1100]; % g strain/broadening %parameters to vary now SysVary.g = [0.1 0.1 0.1]; % +/- 0.05 SysVary.gStrain = [0.02 0.02 0.01]; %function handles now; pass a function to another note the :@ symbol esfit(@pepper,spc,Sys0,SysVary,Exp); %% ======================================================================== % this is the plotting section figure plot(fit1.expSpec); sim= [fit1.expSpec(:)]; hold on plot(fit1.fitSpec); data=[B(:) fit1.expSpec(:)]; save('exp.txt','data','-ascii');% print out xy text file sim=[B(:) fit1.fitSpec(:)]; save('sim.txt','sim','-ascii'); % print out xy text file %% ========================================================================