I'm trying to test the specgram
function located in the signal package in octave but I'm a little confused at the variables in specgram
. What I would like to do is be able to get the specgram
data into an array that will show the frequency and the length of time when the frequency starts and stops.
See example code below: I was trying to get the array to show that for the length of t1
will be $7 \textrm{ Hz}$, t2
will be $12\textrm{ Hz}$ and for t3
will be $2\textrm{ Hz}$. How can I go about doing this?
I'm using ubuntu 12.04 and octave 3.2.4 and the signal pacakage 1.0.11
% combines sig with spectra plot
clear all,clc,tic;
fs=1000;
t1=linspace(0,2*pi,fs/0.1); %need to round off no decimals
t2=linspace(0,2*pi,fs/0.3); %need to round off no decimals
t3=linspace(0,2*pi,fs/0.6); %need to round off no decimals
%Create signal in different arrays
y1=sin(7*t1);
y2=sin(12*t2);
y3=sin(2*t3);
%append arrays to test specgram
yt = [y1 y2 y3];
%plot(yt) %will show combined plot
%Spectrum section
yts=specgram(yt',20,500, 2,1);
plot(yts)
fprintf('\nfinally Done-elapsed time -%4.4fsec- or -%4.4fmins- or -%4.4fhours-\n',toc,toc/60,toc/3600);