This is a static copy of a profile report

Home

fit_Gaussian_model_monosomy_2>fiterror (218 calls, 0.030 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_monosomy_2.m
Copy to new window for comparing multiple runs

Parents (calling functions)

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

Line NumberCodeCallsTotal Time% TimeTime Plot
88
c2_  = p2_c/2 + p2_c*skew_fact...
2180.010 s33.3%
80
time1_1 = 1:floor(p1_b);
2180.010 s33.3%
75
if (p2_c == 0); p2_c = 0.001; ...
2180.010 s33.3%
134
end
2180 s0%
121
sse  = sum(Error_Vector.^2);
2180 s0%
All other lines  0.000 s0.0%
Totals  0.030 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
65Input argument 'time' might be unused, although a later one is used. Consider replacing it by ~.
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 function70
Non-code lines (comments, blank lines)10
Code lines (lines that can run)60
Code lines that did run39
Code lines that did not run21
Coverage (did run/can run)65.00 %
Function listing
time 
calls 
 line
  65 
function sse = fiterror(params,time,data,func_type,locations,show)
    218 
  66 
	p1_a         = abs(params(1));   % height. 
    218 
  67 
	p1_b         = locations(1);     % location. 
    218 
  68 
	p1_c         = abs(params(2));   % width. 
    218 
  69 
	p2_a         = abs(params(3));   % height. 
    218 
  70 
	p2_b         = locations(2);     % location. 
    218 
  71 
	p2_c         = abs(params(4));   % width. 
    218 
  72 
	skew_factor1 = abs(params(5)); 
    218 
  73 
	skew_factor2 = abs(params(6)); 
    218 
  74 
	if (p1_c == 0); p1_c = 0.001; end 
  0.01 
    218 
  75 
	if (p2_c == 0); p2_c = 0.001; end 
    218 
  76 
	if (skew_factor1 < 0); skew_factor1 = 0; end; if (skew_factor1 > 2); skew_factor1 = 2; end; 
    218 
  77 
	if (skew_factor2 < 0); skew_factor2 = 0; end; if (skew_factor2 > 2); skew_factor2 = 2; end; 
    218 
  78 
	if (p1_c < 2);   p1_c = 2;   end; 
    218 
  79 
	if (p2_c < 2);   p2_c = 2;   end; 
  0.01 
    218 
  80 
	time1_1 = 1:floor(p1_b); 
    218 
  81 
	time1_2 = ceil(p1_b):200; 
    218 
  82 
	if (time1_1(end) == time1_2(1));time1_1(end) = [];  end; 
    218 
  83 
	time2_1 = 1:floor(p2_b); 
    218 
  84 
	time2_2 = ceil(p2_b):200; 
    218 
  85 
	if (time2_1(end) == time2_2(1));time2_2(1) = [];end;   
    218 
  86 
	c1_  = p1_c/2 + p1_c*skew_factor1/(100.5-abs(100.5-p1_b))/2; 
    218 
  87 
	p1_c = p1_c*p1_c/c1_; 
  0.01 
    218 
  88 
	c2_  = p2_c/2 + p2_c*skew_factor2/(100.5-abs(100.5-p2_b))/2; 
    218 
  89 
	p2_c = p2_c*p2_c/c2_; 
    218 
  90 
	p1_fit_L = p1_a*exp(-0.5*((time1_1-p1_b)./p1_c).^2); 
    218 
  91 
	p1_fit_R = p1_a*exp(-0.5*((time1_2-p1_b)./p1_c/(skew_factor1/(100.5-abs(100.5-p1_b))) ).^2); 
    218 
  92 
	p2_fit_L = p2_a*exp(-0.5*((time2_1-p2_b)./p2_c/(skew_factor2/(100.5-abs(100.5-p2_b))) ).^2); 
    218 
  93 
	p2_fit_R = p2_a*exp(-0.5*((time2_2-p2_b)./p2_c).^2); 
    218 
  94 
	p1_fit = [p1_fit_L p1_fit_R]; 
    218 
  95 
	p2_fit = [p2_fit_L p2_fit_R]; 
    218 
  96 
	fitted = p1_fit+p2_fit; 
  97 

    218 
  98 
if (show ~= 0) 
  99 
%----------------------------------------------------------------------
 100 
% show fitting in process.
 101 
figure(show);
 102 
% show data being fit.
 103 
plot(data,'x-','color',[0.75 0.75 1]);
 104 
hold on;
 105 
title('monosomy');
 106 
% show fit lines.
 107 
plot(p1_fit,'-','color',[0 0.75 0.75],'lineWidth',2);
 108 
plot(p2_fit,'-','color',[0 0.75 0.75],'lineWidth',2);
 109 
plot(fitted,'-','color',[0 0.50 0.50],'lineWidth',2);
 110 
hold off;
 111 
%----------------------------------------------------------------------
 112 
end;
 113 

    218 
 114 
	width = 0.5; 
    218 
 115 
	switch(func_type) 
    218 
 116 
		case 'cubic' 
 117 
			Error_Vector = (fitted).^2 - (data).^2;
 118 
			sse  = sum(abs(Error_Vector));
    218 
 119 
		case 'linear' 
    218 
 120 
			Error_Vector = (fitted) - (data); 
    218 
 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;
    218 
 134 
end