signal::specgram(n=) . I don't know what "n" means.

I do not know where to find people who know more about R.
I think this is the best place to find people who know a lot about R, so I'll ask.

I have some waveform data and would like to find out in what ways the waveform data is different.
I didn't have any knowledge about frequency conversion, so I studied the following website.

I learned that R has a function in the signal package to create a spectrogram.
I'm thinking of using it, but there are some input fields that I don't understand.

signal::specgram has following optional input fields.

specgram(x = ,
                n = ,
                Fs = ,
                window = ,
                overlap = 

x is data.

  1. Fs is the sampling rate. This is known to be 400 points per second from the information on my measurement equipment.

  2. I think of window as a sliding window.
    A sliding window of a certain length is used to cut out data and shift it in the direction of time to see how the waveform changes. (I am not sure.I don't know what the default value of hanning(n) will be.)

  3. overlap is a value that allows the windows to overlap.

If the window is long, I can capture features in a long span of time.
If the window is short, I can only find features in a short period of time.
The "overlap" allows overlapping so that if there is a feature in the waveform across the window from which the data was cut, it will not be missed.

These are then analyzed for various frequency bands, so I can have a diagram with "time as the horizontal x axis" and "frequency as the vertical y axis".
(I don't know how to do the analysis Hz. Is it a maximum likelihood estimation?)

Here's my question.

What is the purpose of the "n" input field?
I checked some of the codes and it says "number of points".
I have the data from 10 measurements in one place.(Fs=400, 4000 points data.)

Should I specify n = 4000?
Currently, I set it to 10000, but the plot completes without any error.

What should I enter for n?
I don't even know the proper length of the window.

Please let me know if there are any other areas I'm understanding incorrectly.
thank you ffor read!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.