This is a static copy of a profile report

Home

plot_powerspec (66 calls, 5.618 sec)
Generated 05-Aug-2011 13:03:12 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/plotting/plot_powerspec.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
genfigLoadfunction60
genfigPowerSpecfunction6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
44
y_power_spec = (fft(data(t_sta...
662.842 s50.6%
48
eval(sprintf('h = loglog(x_pow...
661.454 s25.9%
49
set(gca,'fontsize',5) 
660.426 s7.6%
45
x_power_spec = Fs/2*linspace(0...
660.415 s7.4%
39
t_sec = (d.antenna0.receiver.u...
660.306 s5.4%
All other lines  0.175 s3.1%
Totals  5.618 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
linspacefunction660.361 s6.4%
newplotfunction660.033 s0.6%
gcffunction660 s0%
lineseriesfunction660 s0%
nextpow2function660 s0%
Self time (built-ins, overhead, etc.)  5.225 s93.0%
Totals  5.618 s100% 
Code Analyzer results
Line numberMessage
1The function return value 'h' might be unset.
Coverage results
[ Show coverage for parent directory ]
Total lines in function50
Non-code lines (comments, blank lines)33
Code lines (lines that can run)17
Code lines that did run15
Code lines that did not run2
Coverage (did run/can run)88.24 %
Function listing
   time   calls  line
1 function [x_power_spec,y_power_spec,h, NFFT]= plot_powerspec(d,data,all,t_start,t_stop, plotOption)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function [x_power_spec,y_power_spec,h, NFFT]= plot_powerspec(d,data,all,t_start,t_stop,plotOption)
6 %
7 % Plots a simple power spectrum of requested data
8 %
9 % Takes sample length by looking at difference between adjacent timestamps
10 % N.B. need to check this as i have found slightly different values
11 % depending on the timestamps selected. Might be better to take length of
12 % data/no. samples
13 %
14 % Plots y on log scale and x as linear
15 % h is the handle to the plot
16 %
17 % Inputs d: complete data set
18 % data: data you want to plot the power spectrum of
19 % t_start: start time (in case you only want to plot a subset of the data)
20 % t_stop : stop_time
21 % all : 1--> if you want to plot all the data
22 % plotOption: string of color, etc.
23 %
24 % act 16/6/2010 : Original version
25 % act 3/10/2010 : Changed order of inputs so default is now to plot power
26 % power spectrum of all the data
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
66 29 if (all==1)
66 30 t_start = 1;
66 31 t_stop = length(d.antenna0.receiver.utc);
66 32 end;
33
66 34 if(nargin<6)
35 plotOption = 'b';
36 end
37
38
0.31 66 39 t_sec = (d.antenna0.receiver.utc(t_start:t_stop)-d.antenna0.receiver.utc(t_start))*24*60*60;
0.02 66 40 t_sec = t_sec - t_sec(1);
66 41 Fs = 1/(t_sec(3)-t_sec(2));
0.13 66 42 L= length(data(t_start:t_stop));
66 43 NFFT = 2^nextpow2(L);
2.84 66 44 y_power_spec = (fft(data(t_start:t_stop),NFFT)/L);
0.42 66 45 x_power_spec = Fs/2*linspace(0,1,NFFT/2+1);
46
47 %eval(sprintf('h = semilogy(x_power_spec, 2*abs(y_power_spec(1:NFFT/2+1)),''%s'');', plotOption));
1.45 66 48 eval(sprintf('h = loglog(x_power_spec, 2*abs(y_power_spec(1:NFFT/2+1)),''%s'');', plotOption));
0.43 66 49 set(gca,'fontsize',5)
66 50 return