From: Andy Hennig on
Hello everyone,

I got a lot of high-resolution data (very sparse as often there is no signal) which I would like to have a spectrogram for. MatLab offers just that function "spectrogram" but my vector is simply way too long. Also the output is just as long as the input, so I'd be stuck with the question of how to compress the output along the x-Axis (time) but not along the y-Axis (frequency).

What can I do?

The obvious answer would be to either downsample or to cut the vector into pieces. Downsampling prior to processing it by "spectrogram" is not an option as I need the frequency-resolution to remain the same; cutting the vector into pieces would work but leaves me with two problems: a) compression along x-axis (but not along y-axis) and b) how to deal with the assumed interruptions at the borders between the spectrogram-pieces I cut the vector in?

I am stuck with these questions and would appreciate any help. Most likely many people had the same problems before me, it's just that I cannot find the answers. Would you know any help?

Thank you for your time,
eisvogel



P.S.
Current data length is at (20d * 12h/d * 3600 s/h * 1000 /s = 864*10^6 digits, but I could cut it down to about (5d * 10h/d * 3600 s/h * 200 /s =) 36 * 10^6 digits, I guess, if I have to.
From: Wayne King on
Andy Hennig <phoenixasche(a)gmx.net> wrote in message <770427515.375878.1277025572848.JavaMail.root(a)gallium.mathforum.org>...
> Hello everyone,
>
> I got a lot of high-resolution data (very sparse as often there is no signal) which I would like to have a spectrogram for. MatLab offers just that function "spectrogram" but my vector is simply way too long. Also the output is just as long as the input, so I'd be stuck with the question of how to compress the output along the x-Axis (time) but not along the y-Axis (frequency).
>
> What can I do?
>
> The obvious answer would be to either downsample or to cut the vector into pieces. Downsampling prior to processing it by "spectrogram" is not an option as I need the frequency-resolution to remain the same; cutting the vector into pieces would work but leaves me with two problems: a) compression along x-axis (but not along y-axis) and b) how to deal with the assumed interruptions at the borders between the spectrogram-pieces I cut the vector in?
>
> I am stuck with these questions and would appreciate any help. Most likely many people had the same problems before me, it's just that I cannot find the answers. Would you know any help?
>
> Thank you for your time,
> eisvogel
>
>
>
> P.S.
> Current data length is at (20d * 12h/d * 3600 s/h * 1000 /s = 864*10^6 digits, but I could cut it down to about (5d * 10h/d * 3600 s/h * 200 /s =) 36 * 10^6 digits, I guess, if I have to.

Hi Andy, the frequency resolution in the spectrogram is determined completely by the value of the WINDOW and FS input arguments. If you want to maintain the frequency resolution from one spectrogram to the next, you only have to keep those constant.

Are there natural places along your time axis where you can break the data into separate records? Every week for example? Obviously what is natural is dictated by what kind of data you are collecting.

Wayne
From: Andy Hennig on
Hi Wayne,

thank you for the reply, I had looked up "window" and "fs" and understood it like: fs/2 should denote the limit for the highest frequency and window/2 should denote the limit for the lowest frequency detectable by the function "spectrogram".

Let's say I cut my data in small enough pieces, made the spectrograms and added them up alltoghether ... then I had solved the vector-is-too-long-to-process-issue.

Now, how can I compress the output-images (-> from "spectrogram") along one axis only, as I would like to downsize the time(!)-resolution from maybe 0.001s to 1h while maintaining the frequency resolution? Cause if I didn't do so, I could print it out using it as for wallpaper. :D

(This chart I made some days ago trying to explain my problem: [url=http://img715.imageshack.us/img715/9851/spectrumfrage3.png]link[/url]. The blue/green-boxes denoting the pieces into which I would cut my vector as you suggested. Whereas the colored arrows beneath denote passing time, which - in the output - I need to have compressed.)

Thank you,
andy
From: Wayne King on
Andy Hennig <phoenixasche(a)gmx.net> wrote in message <1991842386.376203.1277034399566.JavaMail.root(a)gallium.mathforum.org>...
> Hi Wayne,
>
> thank you for the reply, I had looked up "window" and "fs" and understood it like: fs/2 should denote the limit for the highest frequency and window/2 should denote the limit for the lowest frequency detectable by the function "spectrogram".
>
> Let's say I cut my data in small enough pieces, made the spectrograms and added them up alltoghether ... then I had solved the vector-is-too-long-to-process-issue.
>
> Now, how can I compress the output-images (-> from "spectrogram") along one axis only, as I would like to downsize the time(!)-resolution from maybe 0.001s to 1h while maintaining the frequency resolution? Cause if I didn't do so, I could print it out using it as for wallpaper. :D
>
> (This chart I made some days ago trying to explain my problem: [url=http://img715.imageshack.us/img715/9851/spectrumfrage3.png]link[/url]. The blue/green-boxes denoting the pieces into which I would cut my vector as you suggested. Whereas the colored arrows beneath denote passing time, which - in the output - I need to have compressed.)
>
> Thank you,
> andy

Hi Andy, the frequency resolution of the spectrogram is Fs/N where Fs is your sampling frequency and N is the length of your window. If you want the same frequency resolution, you have to fix this ratio as constant. So, if you reduce the sampling frequency, which is what you do by downsampling, you have to reduce the value of N as well. For example, assume your sampling frequency is 1 kHz. If you have a window length of 1000 points, then your frequency resolution is 1 Hz (Fs/N). If you reduce your sampling frequency by a factor of ten, you have to reduce N by a factor of ten as well to maintain the frequency resolution at 1 Hz.

Be careful though, downsampling can introduce aliasing depending on the frequency content of your data.

Wayne
From: Godzilla on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hvl2cr$5tc$1(a)fred.mathworks.com>...
> Andy Hennig <phoenixasche(a)gmx.net> wrote in message <1991842386.376203.1277034399566.JavaMail.root(a)gallium.mathforum.org>...
> > Hi Wayne,
> >
> > thank you for the reply, I had looked up "window" and "fs" and understood it like: fs/2 should denote the limit for the highest frequency and window/2 should denote the limit for the lowest frequency detectable by the function "spectrogram".
> >
> > Let's say I cut my data in small enough pieces, made the spectrograms and added them up alltoghether ... then I had solved the vector-is-too-long-to-process-issue.
> >
> > Now, how can I compress the output-images (-> from "spectrogram") along one axis only, as I would like to downsize the time(!)-resolution from maybe 0.001s to 1h while maintaining the frequency resolution? Cause if I didn't do so, I could print it out using it as for wallpaper. :D
> >
> > (This chart I made some days ago trying to explain my problem: [url=http://img715.imageshack.us/img715/9851/spectrumfrage3.png]link[/url]. The blue/green-boxes denoting the pieces into which I would cut my vector as you suggested. Whereas the colored arrows beneath denote passing time, which - in the output - I need to have compressed.)
> >
> > Thank you,
> > andy
>
> Hi Andy, the frequency resolution of the spectrogram is Fs/N where Fs is your sampling frequency and N is the length of your window. If you want the same frequency resolution, you have to fix this ratio as constant. So, if you reduce the sampling frequency, which is what you do by downsampling, you have to reduce the value of N as well. For example, assume your sampling frequency is 1 kHz. If you have a window length of 1000 points, then your frequency resolution is 1 Hz (Fs/N). If you reduce your sampling frequency by a factor of ten, you have to reduce N by a factor of ten as well to maintain the frequency resolution at 1 Hz.
>
> Be careful though, downsampling can introduce aliasing depending on the frequency content of your data.
>
> Wayne

have you consider using a log plot for the frequency axis?