-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc_power.m
More file actions
27 lines (24 loc) · 851 Bytes
/
Copy pathcalc_power.m
File metadata and controls
27 lines (24 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% Camila Rosa (crs94 @GitHub), 2016
% Cristiano Alves (ishiikurisu @GitHub), 2016
% ------------
% calc_power: Updates the signal and the queue
% Usage: Input the name of the variable in which
% the signal is stored and the size of the
% window that on desires to select
% Inputs:
% data = [array] Variable in which the signal
% is stored
% wsize = [double] Size of the window
% Output:
% pwrspec = [array] Array conatining the power
% spectra calculated
% ------------
function [pwrspec] = calc_power(data, wsize)
[data, queue] = update_queue(data, wsize);
n = 1;
pwrspec = 0;
while length(queue) > 0
pwrspec(n) = sqrt(sum(queue.^2));
n = n + 1;
[data, queue] = update_queue(data, wsize);
end