Getting Frequency and amplitude from input velocity and output velocity

13 visualizaciones (últimos 30 días)
I am interested on getting the frequency responce (bode plot) from a physical system (complex spring-mass-damper system). Essentially my goal is to gather matrixes of velocity vs time of the input and the velocity vs time of the output and then I want to generate the frequency vs time graph of and the amplitude vs time graph which can be used to create a bode plot.
I am familiar with the FFT function which I use frequently; however, the input frequency would not be constant in this data set and the frequency may change over a range of 0-100 Hz. I thought about applying the FFT function to small sets of the data (say split the data into 100 sections and determine the average frequency and amplitude of that section) to estimate it.
I believe you can fit a transfer function to the data based on the input and output data in the time domain but I have not sucessfully done that yet. Furthmore, I want to descretly do this to pick up things in the physical system which do not always follow the ideal bode plot (for example if there is another point of resonance in the system from poor construction or something)
I can also "brute force it" by writing a function to determine the data I am looking for based on the period between peaks and the amplitude of the peaks however I do not like this method very much.
I am hoping that there is a function in matlab which is able to continiously determine the freqnency and amplitude of a data set and plot it.
Here is a mathmatical example of way I am trying to do but I want to do it discretly with data from accelerometers:
Here is the input signal: v = sin(2*pi*t^2) where t is time. In this case, the frequency plot would be f = t, or constlantly increasing at a constant rate. What I am trying to get is essently "f = t" based on a descrete set of data of sin(2*pi*t^2). Of course the rate of change of freqnecy would not be constant and may be irratic.
Thanks and let me know if you need any more information!

Respuestas (1)

Balavignesh
Balavignesh el 24 de Mayo de 2024
Hi Julian,
It is my understanding that you are looking to perform a time-frequency analysis on signals where the frequency content changes over time. 'FFT' is a powerful tool for analyzing the frequency content of signals but is limited, as it assumes the frequency content is stationary.
For non-stationary signals, 'Short-Time Fourier Transform (STFT)' may be more appropriate. 'STFT' divides the signal into small enough segments where the signal's frequency content is assumed to be stationary. This method allows you to see how the frequency content of your signal changes over time. You could use 'spectrogram' function in MATLAB to perform 'STFT'. This function will give you a time-varying frequency spectrum of your signal.
The following code snippet provides a rough implementation:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector
% Create a non-stationary signal
v = sin(2*pi*t.^2);
% Perform STFT
window = 256; % Window length for STFT
noverlap = 250; % Number of overlapping samples
nfft = 1024; % Number of FFT points
[s,f,t,p] = spectrogram(v,window,noverlap,nfft,Fs,'yaxis');
% Plot the spectrogram
surf(t,f,10*log10(abs(p)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time (s)');
ylabel('Frequency (Hz)');
title('Spectrogram');
Kindly have a look at the following documentation links to have more information on:
Hope that helps!
Balavignesh

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by