Implemented "thyme" fitting function
This commit is contained in:
		
							parent
							
								
									b53f7f3044
								
							
						
					
					
						commit
						821ed661a4
					
				| @ -1,4 +1,4 @@ | |||||||
| function [params] = simulation_TREPR(Exp,Sys,params) | function [params] = simulation_TREPR(Exp,Sys0,params) | ||||||
| %SIMULATION_TREPR Summary of this function goes here | %SIMULATION_TREPR Summary of this function goes here | ||||||
| % | % | ||||||
| %   Detailed explanation goes here | %   Detailed explanation goes here | ||||||
| @ -19,10 +19,12 @@ ax = axes(plotpanel); | |||||||
| ax.XLabel.String = 'magnetic field'; | ax.XLabel.String = 'magnetic field'; | ||||||
| ax.YLabel.String = 'Intensity'; | ax.YLabel.String = 'Intensity'; | ||||||
| %plot manual simulation | %plot manual simulation | ||||||
| [bfield,spec] = pepper(Sys,Exp); | [bfield,spec] = pepper(Sys0,Exp); | ||||||
| spec_norm = spec/max(spec); % normalize the simulation | spec_norm = spec/max(spec); % normalize the simulation | ||||||
| plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | ||||||
|      bfield,spec_norm,'b','LineWidth',1.2) |      bfield,spec_norm,'b','LineWidth',1.2) | ||||||
|  | xlabel 'Magnetic Field / mT' | ||||||
|  | ylabel 'EPR signal / A. U.' | ||||||
| legend('experimental','simulation') | legend('experimental','simulation') | ||||||
| axis tight | axis tight | ||||||
| 
 | 
 | ||||||
| @ -284,13 +286,38 @@ uicontrol(InpTx); %passes focus to first input | |||||||
| uiwait(fig) | uiwait(fig) | ||||||
| 
 | 
 | ||||||
| %% Callback functions | %% Callback functions | ||||||
|     function SimStartButtonPushed(src,event) |     function BestSys = SimStartButtonPushed(src,event) | ||||||
|          |         %get Vary and Opt from Input | ||||||
|  |         varT1 = str2double(get(InpTx,'String')); | ||||||
|  |         varT2 = str2double(get(InpTy,'String')); | ||||||
|  |         varT3 = str2double(get(InpTz,'String')); | ||||||
|  |         Vary.Temperature = [varT1 varT2 varT3]; | ||||||
|  |         varD = str2double(get(InpD,'String')); | ||||||
|  |         varE = str2double(get(InpE,'String')); | ||||||
|  |         Vary.D = [varD varE]; | ||||||
|  |         varGauss = str2double(get(InpGauss,'String')); | ||||||
|  |         varLor = str2double(get(InpLor,'String')); | ||||||
|  |         Vary.lw = [varGauss varLor]; | ||||||
|  |         Vary.g = str2double(get(InpG,'String')); | ||||||
|  |         FitOpt.Method = get(InpMeth,'String'); | ||||||
|  |         FitOpt.Scaling = get(InpScal,'String'); | ||||||
|  |         %perform fit | ||||||
|  |         Sys0.Temperature = [0 0 0]; | ||||||
|  |         [BestSys,BestSpc] = esfit('thyme',params.max_mean,Sys0,Vary,Exp,[],FitOpt); | ||||||
|  |         plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | ||||||
|  |                 0.1*params.Field_Vector,BestSpc,'b','LineWidth',1.2) | ||||||
|  |         xlabel 'Magnetic Field / mT' | ||||||
|  |         ylabel 'EPR signal / A. U.' | ||||||
|  |         legend('experimental','simulation') | ||||||
|  |         axis tight | ||||||
|  |     end | ||||||
|  |      | ||||||
|  |     function SimSaveButtonPushed(src,event) | ||||||
|  | %         Sys = BestSys; | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     function SimDoneButtonPushed(src,event) |     function SimDoneButtonPushed(src,event) | ||||||
|         close 'Simulation' |         close 'Simulation' | ||||||
|     end |     end | ||||||
| 
 |   | ||||||
| end | end | ||||||
| 
 |  | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user