This is a static copy of a profile reportHome
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)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
44 | y_power_spec = (fft(data(t_sta... | 66 | 2.842 s | 50.6% |  |
48 | eval(sprintf('h = loglog(x_pow... | 66 | 1.454 s | 25.9% |  |
49 | set(gca,'fontsize',5) | 66 | 0.426 s | 7.6% |  |
45 | x_power_spec = Fs/2*linspace(0... | 66 | 0.415 s | 7.4% |  |
39 | t_sec = (d.antenna0.receiver.u... | 66 | 0.306 s | 5.4% |  |
All other lines | | | 0.175 s | 3.1% |  |
Totals | | | 5.618 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
linspace | function | 66 | 0.361 s | 6.4% |  |
newplot | function | 66 | 0.033 s | 0.6% |  |
gcf | function | 66 | 0 s | 0% |  |
lineseries | function | 66 | 0 s | 0% |  |
nextpow2 | function | 66 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 5.225 s | 93.0% |  |
Totals | | | 5.618 s | 100% | |
Code Analyzer results
Line number | Message |
1 | The function return value 'h' might be unset. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 50 |
Non-code lines (comments, blank lines) | 33 |
Code lines (lines that can run) | 17 |
Code lines that did run | 15 |
Code lines that did not run | 2 |
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