Generate a sinusoid function to data

조회 수: 6 (최근 30일)
Tim Ubbink
Tim Ubbink 2017년 5월 3일
답변: Greg Heath 2017년 5월 8일
Hi there,
On beforehand, I want to say that I am a complete rookie when it comes to using Matlab.
So I'm trying to create a classification based of a set of data. The data is created by an instrument which measures N (m/s2) over time. I want the classification to be represented by an equation or function. In figure 1 I plotted the data over n.
The eventual goal is to fit the generated equation to multiple datasets.
Does anyone know if it's possible to generate a function or equation to this graph? Is it best to generate an sinusoid function? And how can I do this using Matlab?
Cheers,
Tim

답변 (2개)

Star Strider
Star Strider 2017년 5월 3일
I do not know what you mean by ‘classification’. If your signal is composed of several different signals and you want a relatively straightforward way of determining what they are, the procedure most likely to give you the result you want is independent component analysis. Search the File Exchange for an appropriate approach for your data.
If you simply want to do curve-fitting of your data, it is best to begin by calculating the fft (link) of your data to determine the significant frequency components. There appear to be several in your data.
I would then use bandpass filters for each significant frequency (Chebyshev Type II design would likely be best), then fit the output of each filter using for example the procedure in Curve fitting to a sinusoidal function (link), or How to filter noise from time-frequency data and find natural frequency of a cantilever? (link). The final fitted function would be the sum of these. You can at best get an approximation.
  댓글 수: 2
Tim Ubbink
Tim Ubbink 2017년 5월 8일
편집: Tim Ubbink 2017년 5월 8일
Hi Star Strider,
Many thanks for your answer!
Reading your comment it feels like you interpreted my data as chemical analysis. But I could be wrong.
The thing is: I am trying to identify the re-occurrence of these peaks in a larger set of data. This way I was hoping to identify undertaken activities by a user. As (poorly) illustrated in the second figure.
The earlier figure, figure 1, represents walking. So my goal is to identify these three activities from each other using a function or equation of some sort.
I hope this clears things up.
Greets,
Tim
Star Strider
Star Strider 2017년 5월 8일
My pleasure.
With your clarification, independent component analysis is likely the most appropriate procedure. You would have to use it separately on each activity segment. Then a Fourier transform fft (link) if necessary would further identify the frequency components.
For references, I would begin with Independent Compononent Analysis: A Tutorial Introduction (ISBN: 9780262693158), and the File Exchange contribution PCA and ICA Package (link).
Also, the short-time Fourier transform (STFT, the spectrogram function) is used in electroencephalogram pattern classification (I published on this a couple decades ago), and the same approach could be appropriate for what you are doing. We used a linear discriminant analysis with PCA, but there are likely better and more efficient classification methods available now, including neural nets.

댓글을 달려면 로그인하십시오.


Greg Heath
Greg Heath 2017년 5월 8일
If you only have the three classes shown, it looks like they can be classified using their spectral representations via, for example, the amplitudes obtained from a fft.
It looks like a simple classifier like LINEAR, QUADRATIC or NEAREST-NEIGHBOR using spectral amplitudes will do the trick.
It doesn't seem like a neural net is necessary.
Hope this helps.
Thank you for formally accepting my answer
Greg
PS How many points in each sample?

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by