This is a static copy of a profile report

Home

fit_Gaussian_model_disomy_2>fiterror (14717 calls, 1.895 sec)
Generated 14-Nov-2016 07:47:12 using cpu time.
subfunction in file /home/user/dev/ymap/scripts_seqModules/scripts_WGseq/fit_Gaussian_model_disomy_2.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
fminsearch>checkfunsubfunction14717
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
114
width = 0.5;
147170.161 s8.5%
108
p3_fit_L = p3_a*exp(-0.5*((tim...
147170.141 s7.4%
107
p2_fit   = p2_a*exp(-0.5*((tim...
147170.121 s6.4%
112
fitted = p1_fit+p2_fit+p3_fit;
147170.111 s5.9%
121
sse          = sum(Error_Vecto...
147170.091 s4.8%
All other lines  1.270 s67.0%
Totals  1.895 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
73Input argument 'show' might be unused. If this is OK, consider replacing it by ~.
84The value assigned to variable 'skew_factor2' might be unused.
114The value assigned to variable 'width' might be unused.
132This statement (and possibly following ones) cannot be reached.
Coverage results
Show coverage for parent directory
Total lines in function62
Non-code lines (comments, blank lines)4
Code lines (lines that can run)58
Code lines that did run46
Code lines that did not run12
Coverage (did run/can run)79.31 %
Function listing
time 
calls 
 line
  73 
function sse = fiterror(params,time,data,func_type,locations,show)
  0.05 
  14717 
  74 
	p1_a         = abs(params(1));   % height. 
  0.02 
  14717 
  75 
	p1_b         = locations(1);     % location. 
  14717 
  76 
	p1_c         = abs(params(2));   % width. 
  0.01 
  14717 
  77 
	p2_a         = abs(params(3));   % height. 
  14717 
  78 
	p2_b         = locations(2);     % location. 
  0.02 
  14717 
  79 
	p2_c         = abs(params(4));   % width. 
  0.02 
  14717 
  80 
	p3_a         = abs(params(5));   % height. 
  0.03 
  14717 
  81 
	p3_b         = locations(3);     % location. 
  0.01 
  14717 
  82 
	p3_c         = abs(params(6));   % width. 
  0.04 
  14717 
  83 
	skew_factor1 = abs(params(7)); 
  14717 
  84 
	skew_factor2 = 1; 
  0.04 
  14717 
  85 
	skew_factor3 = abs(params(9)); 
  14717 
  86 
	if (p1_c == 0); p1_c = 0.001; end; 
  0.03 
  14717 
  87 
	if (p2_c == 0); p2_c = 0.001; end; 
  0.02 
  14717 
  88 
	if (p3_c == 0); p3_c = 0.001; end; 
  0.02 
  14717 
  89 
	if (skew_factor1 < 0); skew_factor1 = 0; end; if (skew_factor1 > 2); skew_factor1 = 2; end; 
  0.02 
  14717 
  90 
	if (skew_factor3 < 0); skew_factor3 = 0; end; if (skew_factor3 > 2); skew_factor3 = 2; end; 
  0.03 
  14717 
  91 
	if (p1_c < 2);   p1_c = 2;   end; 
  0.02 
  14717 
  92 
	if (p2_c < 2);   p2_c = 2;   end; 
  0.02 
  14717 
  93 
	if (p3_c < 2);   p3_c = 2;   end; 
  0.02 
  14717 
  94 
	time1_1 = 1:floor(p1_b); 
  0.02 
  14717 
  95 
	time1_2 = ceil(p1_b):200; 
  0.08 
  14717 
  96 
	if (time1_1(end) == time1_2(1));    time1_1(end) = [];  end; 
  0.01 
  14717 
  97 
	time2   = time; 
  0.07 
  14717 
  98 
	time3_1 = 1:floor(p3_b); 
  14717 
  99 
	time3_2 = ceil(p3_b):200; 
  0.02 
  14717 
 100 
	if (time3_1(end) == time3_2(1));    time3_2(1) = [];    end; 
  14717 
 101 
	c1_  = p1_c/2 + p1_c*skew_factor1/(100.5-abs(100.5-p1_b))/2; 
  0.02 
  14717 
 102 
	p1_c = p1_c*p1_c/c1_; 
  14717 
 103 
	c3_  = p3_c/2 + p3_c*skew_factor3/(100.5-abs(100.5-p3_b))/2; 
  0.05 
  14717 
 104 
	p3_c = p3_c*p3_c/c3_; 
  0.05 
  14717 
 105 
	p1_fit_L = p1_a*exp(-0.5*((time1_1-p1_b)./p1_c).^2); 
  0.07 
  14717 
 106 
	p1_fit_R = p1_a*exp(-0.5*((time1_2-p1_b)./p1_c/(skew_factor1/(100.5-abs(100.5-p1_b))) ).^2); 
  0.12 
  14717 
 107 
	p2_fit   = p2_a*exp(-0.5*((time2  -p2_b)./p2_c).^2); 
  0.14 
  14717 
 108 
	p3_fit_L = p3_a*exp(-0.5*((time3_1-p3_b)./p3_c/(skew_factor3/(100.5-abs(100.5-p3_b))) ).^2); 
  0.04 
  14717 
 109 
	p3_fit_R = p3_a*exp(-0.5*((time3_2-p3_b)./p3_c).^2); 
  0.05 
  14717 
 110 
	p1_fit = [p1_fit_L p1_fit_R]; 
  0.09 
  14717 
 111 
	p3_fit = [p3_fit_L p3_fit_R]; 
  0.11 
  14717 
 112 
	fitted = p1_fit+p2_fit+p3_fit; 
 113 

  0.16 
  14717 
 114 
	width = 0.5; 
  0.04 
  14717 
 115 
	switch(func_type) 
  0.04 
  14717 
 116 
		case 'cubic' 
 117 
			Error_Vector = (fitted).^2 - (data).^2;
 118 
			sse          = sum(abs(Error_Vector));
  14717 
 119 
		case 'linear' 
  14717 
 120 
			Error_Vector = (fitted) - (data); 
  0.09 
  14717 
 121 
			sse          = sum(Error_Vector.^2); 
 122 
		case 'log'
 123 
			Error_Vector = log(fitted) - log(data);
 124 
			sse          = sum(abs(Error_Vector));
 125 
		case 'fcs'
 126 
			Error_Vector = (fitted) - (data);
 127 
			%Error_Vector(1:round(G1_b*(1-width))) = 0;
 128 
			%Error_Vector(round(G1_b*(1+width)):end) = 0;
 129 
			sse          = sum(Error_Vector.^2);
 130 
		otherwise
 131 
			error('Error: choice for fitting not implemented yet!');
 132 
			sse          = 1;            
 133 
	end;
  0.05 
  14717 
 134 
end