Fourier transform (fft) in MATLAB from accelerometer data for acceleration, velocity and position

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ต.ค. 2024

ความคิดเห็น • 88

  • @SHOHOB2000
    @SHOHOB2000 5 หลายเดือนก่อน +1

    hello sir,
    at 4:00 I "nearly" have the same problem but in a different case
    So, I have an accelerometer put on car, and I'm asked to integrate it's output to get velocity.
    Now velocity should return back to zero because car eventually stops but this doesn't happen instead velocity stabilizes at -ve value
    The problem is detrend won't solve this issue because in your case a vibrating object must be periodic motion meaning it's oscillating around zero position so we know for a fact that it's slope should be zero but in mu case it's different as the car can go anywhere and isn't periodic motion and I'm struggling to fix this issue
    If you need to know the sensor it is inside a phone (we are using the accelerometer inside it) labeled lsm6dsm ACCELEROMETER
    thanks in advance for the helpful tutorial :)

    • @MathiasMagdowski
      @MathiasMagdowski  5 หลายเดือนก่อน +1

      Thanks for your question. What do you exactly mean by the '-ve value', at which the velocity stabilizes if the car stops?
      In your case, I would assume that the acceleration should be almost zero and very stable, if the car really stopped, because you should then only see small vibrations due to the running motor or something similar. Such small and stable values of the acceleration should be very uncommon in normal driving conditions, except for a very smooth road and very constant driving speed.
      So I would suggest to try to detect very small and very stable values of the acceleration by some well-defined criterion, under which the car can be assumed to have come to a full stop. In this case you just reset your integrated (and possible erronous) velocity back to zero.
      Let me know if this helps.

  • @mowzafmouwad7898
    @mowzafmouwad7898 5 หลายเดือนก่อน +1

    I am just wondering at the video minute 5:56 you showed the graph of position which i believe you mean displacement, is it normal to be 150 meters? I was performing similar analysis and got even much bigger value and I find it weird somehow. Thank you

    • @MathiasMagdowski
      @MathiasMagdowski  5 หลายเดือนก่อน

      The position is determined by integrating the velocity over time, which in turn is determined by integrating the measured acceleration over time. Any small measurement error or uncertainty in the acceleration will result in a linearly increasing deviation in velocity, which in turn will result in a quadratically increasing deviation in position. To avoid this, careful filtering or detrending of the data is required. This is the purpose of the procedure presented in the video.

    • @mowzafmouwad7898
      @mowzafmouwad7898 5 หลายเดือนก่อน

      Thank you for the reply, I have just noticed that when using the cumtrapz the data is cumulative. If I am willing to get the displacement at each point instead of the cumulative what do you suggest? I have been trying trapz however I had errors in matlab code and didn't work. Thank you again

    • @MathiasMagdowski
      @MathiasMagdowski  5 หลายเดือนก่อน

      ​@@mowzafmouwad7898 Thank you for your further question. I think you are misinterpreting the results of the functions cumtrapz (de.mathworks.com/help/matlab/ref/cumtrapz.html) and trapz (de.mathworks.com/help/matlab/ref/trapz.html). The result of the cumtrapz function is again an array or vector containing the primitive or antiderivative function of an input array or vector. The result of the trapz function is simply the resulting integral, i.e., a scalar number. See this simple example of integrating the cos function, which approximately gives the sin function and the final integral over a full period which is (almost) zero.
      >> x=linspace(0,2*pi,13)
      x =
      0.00000 0.52360 1.04720 1.57080 2.09440 2.61799 3.14159 3.66519 4.18879 4.71239 5.23599 5.75959 6.28319
      >> y=cos(x)
      y =
      Columns 1 through 11:
      1.0000e+000 8.6603e-001 5.0000e-001 6.1230e-017 -5.0000e-001 -8.6603e-001 -1.0000e+000 -8.6603e-001 -5.0000e-001 -1.8369e-016 5.0000e-001
      Columns 12 and 13:
      8.6603e-001 1.0000e+000
      >> cumtrapz(x,y)
      ans =
      0.00000 0.48852 0.84615 0.97705 0.84615 0.48852 0.00000 -0.48852 -0.84615 -0.97705 -0.84615 -0.48852 -0.00000
      >> trapz(x,y)
      ans = -1.6653e-016

    • @MathiasMagdowski
      @MathiasMagdowski  5 หลายเดือนก่อน

      In short, if the cumtrapz function doesn't help you, the trapz function won't either, because the result of the trapz function is also included in the output of the cumtrapz function (i.e., in the last element of the output vector):
      >> cumtrapz(x,y)(end)
      ans = -1.6653e-16
      >> trapz(x,y)
      ans = -1.6653e-16

  • @charanchaganti1635
    @charanchaganti1635 3 หลายเดือนก่อน +1

    Hi,
    I have BNO055 acceleration data mounted on a vehicle, I need to calculate velocity and position from this data, please help

    • @MathiasMagdowski
      @MathiasMagdowski  3 หลายเดือนก่อน

      I have no experience with the mentioned accelerometer, but you might send me a sample of your data and your well-commented program to my e-mail address mathias.magdowski@ovgu.de

  • @JohnBo199
    @JohnBo199 7 หลายเดือนก่อน +1

    Hello I would like to use my Raspberry Pi and an accelerometer to monitore the vibrations at a robot arm . So I get acceleration values from all three axes x,y,z over time when I start the process including the acceleration due to gravity g depending on how the sensor is oriented.
    What do I do with the acceleration due to gravity, because when the system is horizontal at rest it experiences about 0 m/s^2 on the x and y axis at rest and the z-axis understandably 9.81 m/s^2. How do I deal with this when the acceleration values of the vibration are added to this?
    Do you have any idea how I can calculate the displacement from the three data values? Should I record each axis individually and then look at the values and integrate twice? Or do you have another idea and should I consider the interaction of the three axes?
    Thank you very much :) I really liked your explanations :)

    • @MathiasMagdowski
      @MathiasMagdowski  7 หลายเดือนก่อน +1

      Thanks for this excellent question. I would also need to think about this problem a little longer, but I would argue that if you are rotating your accelerometer you cannot really use it anymore to obtain an absolute position as even a linear movement along a straight line might be measured with changing parts into the x, y and z component of the acceleration. To compensate this effect, you would also need a three-axis gyroscope that ideally uses the same sampling rate, so that you could convert the rotating Cartesian coordinate system of your moving and rotating accelerometer to a fixed, absolute Cartesian coordinate system of the environment.
      If you only want to analyze the rapid vibrations, I would simply remove the constant part of each component of your measured time-dependent acceleration individually, e.g. by subtracting the mean value. I would assume that your vibration happens much faster than the movement of the robot arm itself, so you only need to look at short sections of your time function, long enough to capture the vibrations, but short in comparison with the arm movement. You can also do a Fourier transform and then simply remove the constant part there. After integrating the time function twice or after dividing the spectrum by j*omega twice, you should obtain the time function or spectrum of the displacement.

    • @JohnBo199
      @JohnBo199 7 หลายเดือนก่อน +1

      @@MathiasMagdowski I send you an mail, because i got another question. Maybe you can help me out there. Lovely greetings.

    • @MathiasMagdowski
      @MathiasMagdowski  7 หลายเดือนก่อน

      @@JohnBo199 Thanks, I have received it well.

  • @asifraj321
    @asifraj321 8 หลายเดือนก่อน +1

    Sir, i have data points (t,V) of blood flow waveform. I want to fit this data with the help of fft. The matlab tool did't accurately fit with eight co-efficient.Could you help me regarding this?

    • @MathiasMagdowski
      @MathiasMagdowski  8 หลายเดือนก่อน +1

      Sure, you can send me your data to my e-mail address mathias.magdowski@ovgu.de and I might have a look.
      Why do you want to have exactly eight coefficients?

    • @asifraj321
      @asifraj321 8 หลายเดือนก่อน +1

      Thank you for your prompt response, sir. We require more than eight coefficients to precisely fit the data. However, the MATLAB curve fitting tool offers only up to eight coefficients by default, which is why we are seeking your assistance. I am sending you the data

    • @MathiasMagdowski
      @MathiasMagdowski  8 หลายเดือนก่อน +1

      @@asifraj321 I have had a look at your problem. The question is, why you do want to use the curve-fitting toolbox to do the Fourier analysis and why you not simply do it by yourself using the method presented in my video.
      There is also another video explaining the Fourier reconstruction, which might be also very interesting for you:
      "How to reconstruct a periodic signal as a sum of cosine functions from the freq. spectrum in MATLAB"
      th-cam.com/video/OvyTRxZSolU/w-d-xo.html
      Anyhow, I have prepared a short script that uses my fourier.m function to do the FFT analysis of your data. It reads it your time-domain data, plots it, does a Fourier analysis, plots the spectrum and does a Fourier reconstruction based on the N most important spectral components. You can enlarge this number to achieve a better fit. The corresponding amplitudes and phases of these harmonics are printed to the MATLAB command line while running the script as in the above-mentioned video.
      You can compare theses results with the results of the curve-fitting toolbox. In my script, the harmonics are given by amplitude and phase, in the toolbox by the coefficients a for cosine functions and b for sine functions. You can calculate or convert them by
      a=amplitude .*cos(phase)
      b=-amplitude .*sin(phase)
      You do not get exactly the same results, but the outcome is quite close.
      As you mentioned, the curve-fitting toolbox only allows to obtain 8 harmonics or 2 * 8 = 16 coefficients plus the constant part. My function fourier.m allows to obtain also higher numbers of harmonics or coefficients. If your time function has e.g. 200 values, you would also get 100 harmonics (plus the constant part). If you use all these harmonics for the reconstruction, you would also get a perfect fit.
      The question therefore is, how many harmonics or how many coefficients you really need to get a reasonable agreement and to perform your intended analysis and further processing of the results. If you use too many harmonics and coefficients, there is clearly the danger of over-fitting your data.

    • @asifraj321
      @asifraj321 8 หลายเดือนก่อน +1

      Thank you for explaining in detail. It's very helpful.

  • @radon3292
    @radon3292 6 หลายเดือนก่อน +1

    Why is the name of the Y axis is maximum periodic change of acceleration in m/s^2? It is not jerk, since units are in acceleration. Thus why change? Is it just amplitude of vibration at particular frequency? Thanks!

    • @MathiasMagdowski
      @MathiasMagdowski  6 หลายเดือนก่อน +1

      Yes, you are probably right that my terminology might be a bit misleading here.
      The rate of change (or time derivitive) of the position (in m) is the velocity (in m/s).
      The rate of change (or time derivitive) of the velocity (in m/s) is the acceleration (in m/s²).
      The rate of change (or time derivitive) of the acceleration (in m/s²) is the jerk (in m/s³).
      Nevertheless, what I called "periodic change" or "maximum periodic change" is just the amplitude or "change", not the "rate of change" or time derivitive of the corresponding quantity, i.e. position, velocity and acceleration.

  • @aryashah7892
    @aryashah7892 ปีที่แล้ว +3

    Hello Sir, I am having trouble while performing fourier transform of position (x_t). While using 'fourier' command exactly as you coded "[f,X_f]=fourier(t,x_t,'sinus');" I'm getting an error stating 'Incorrect number or types of inputs or outputs for function 'fourier'.' Could you please explain me the issue here, and what can be done to overcome this?!!

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +1

      Thanks for your question. I would assume, that the input variables t or x_t are not correct in your case. Both t and x_t must be plain numeric vectors with the same length. The time vector t should be given in the unit s, must start with 0 and must have equidistant time steps as described in the comments of the function. If t or x_t are cell arrays, tables, structs or something else, the fourier.m function might not work as expected or might not work at all. You can check the nature of your input variables t and x_t in the MATLAB workspace or variable editor.

    • @aryashah7892
      @aryashah7892 ปีที่แล้ว +2

      @@MathiasMagdowski Thank you for your response sir. I am dealing with signal analysis form sample data sets of accelerometer to analyse the vibrations occurred while collision of a leg prosthesis against a stair. In between I had a question, how to do bode plots and get cut off frequency when we don't have for instance 'sine signal' generated directly from the matlab function(x = sin(2*pi*f*t))? Instead we have data sets of acceleration and time and that have been used to plot signal. In this case of datasets how could we apply bode plots formulation?

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +1

      @@aryashah7892 A Bode plot is nothing more than a combination of two plots showing the magnitude and phase as a function of frequency, see:
      en.wikipedia.org/wiki/Bode_plot
      Typically, both the frequency axes as well as the magnitude axis are logarithmically scaled, while the phase axis is linearly scaled. Bode plots are usually used for transfer functions or impedance operators, but you can also use if for the spectrum of a signal. If your time-domain data is sampled correctly (not undersampled, capturing a whole aperidodic impulse or more than one period of the fundamental frequency of a periodic function, proper amplitude resolution, not only noise, no trend, no amplitude jump from the beginning to the end or proper windowing), you should see one main or several spikes, peaks or resonances in your magnitude spectrum. These will be the frequencies of the vibrations occuring during or after the collision. For high frequencies, the magnitude should usually go down into the noise floor. You could define a cut-off frequency between the "resonance" region and the "noise" region.

  • @CatManPersian
    @CatManPersian 2 หลายเดือนก่อน +1

    Dear Mathias, You are always full of new things to learn.
    Thank you.
    Hope you do well.

    • @MathiasMagdowski
      @MathiasMagdowski  2 หลายเดือนก่อน

      @@CatManPersian Great, your feedback is appreciated.

  • @PandiyanM22PHD064
    @PandiyanM22PHD064 ปีที่แล้ว +2

    Hi sir, I have the vibration data to diagnose the bearing fault can I use the same code for FFT

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +2

      Thanks for the question. You probably can use the very same code to calculate the spectrum of your sampled vibration signals in a straightforward manner. The bigger challenge will then be to detect a bearing fault from the spectrum itself. A fault in the bearing might lead to stronger vibrations (so a larger amplitude), to a shift of resonant frequencies or might lead to the generation of new frequency components which were not present in the spectrum before. You will certainly need to capture vibration data with different faulty and faultless bearings for comparison and validation of robustness and repeatability of your method.

  • @faridpiran8140
    @faridpiran8140 ปีที่แล้ว +2

    Hi Mathias, from experiment of the cantilever beam, I obtained the time and millivolt from accelerometer, now I want to plot real and imaginary part of FFT in MATLAB code by using Nyquist. Could you please help me. Thanks

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +1

      You may send me your data and corresponding MATLAB files to my e-mail address mathias.magdowski@ovgu.de. If you do so, please:
      - don't forget to attach the (preferably zipped) code to the mail
      - clearly indicate the main program or script to run
      - make sure (if possible) that it runs on your computer without problems/errors
      - meaningfully comment every single line of code
      - describe what the program should do, what to expect as the output and any discrepancy from that
      - don't send me files, which are not necessary
      - have questions as specific as possible

  • @mohamedredaboulezaz6498
    @mohamedredaboulezaz6498 ปีที่แล้ว +2

    hello sir, i have vibration data and i want to plot the fft of the velocity and acceleration, however the fft i get doesnt represent the expected plot and the frequency components are not peaking in the correspending rpm!
    can you please help

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +1

      You may send me your data and corresponding MATLAB files to my e-mail address mathias.magdowski@ovgu.de. If you do so, please:
      - don't forget to attach the (preferably zipped) code to the mail
      - clearly indicate the main program or script to run
      - make sure (if possible) that it runs on your computer without problems/errors
      - meaningfully comment every single line of code
      - describe what the program should do, what to expect as the output and any discrepancy from that
      - don't send me files, which are not necessary
      - have questions as specific as possible

  • @rwaewae
    @rwaewae ปีที่แล้ว +2

    How do we apply wavelet coherence in Matlab? thanx

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +2

      To be honest, I have no clue about wavelet coherence and how to apply it in MATLAB.

  • @Luigi_re2000
    @Luigi_re2000 ปีที่แล้ว +2

    I have velocity data measure s in the laboratory ( in all direction ) and I want to do the turbulence spectrum graph to see the curve of -5/3”2D spatial Fourier” , but I don’t know how to process the information. Any suggestions?

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +2

      Dear Luigi, thanks for your inquiry. Can you give some more details about the '-5/3 2D spatial Fourier' decomposition? If you want to do a two-dimensional Fourier analysis, you may use the fft2 function from MATLAB instead of the plain fft function for the one-dimensional analysis, see: www.mathworks.com/help/matlab/ref/fft2.html

  • @nathanaelwailyn8490
    @nathanaelwailyn8490 9 หลายเดือนก่อน +1

    Hi Mathias,
    I have a vibration data taken from an accelerometer on a cnc machine , I have the acceleration-time data but when converting it to displacement, I get a smooth graph , when zooming in, there is no oscillation like the one you have obtained from this video, hence, I am unable to obtain an accurate frequency graph. Any suggestion?

    • @MathiasMagdowski
      @MathiasMagdowski  9 หลายเดือนก่อน

      Thanks for the question. How did you convert the acceleration (im m/s²) into a displacement (in m), directly in time domain using the cumtrapz and detrend functions or in frequency domain by dividing the obtained spectrum of the acceleration two times by j·ω (where j is the imaginary unit and ω is the angular frequency in 1/s) and then using and inverse Fourier transform back into time domain? Have you tried to use my code example linked in the video description? I suggest to monitor and display the result of each intermediate step of the calculation in order to check the correctness of the approach and the validity of the outcomes.

  • @onedepressedengineer_2003
    @onedepressedengineer_2003 9 หลายเดือนก่อน +1

    Great Video sir. Although I have a slight inherent difficulty. I have a data of more than 2900 readings of wind speeds, each taken at a minute (so basically I have more than 2900 minutes of speed data) but the problem is that they are not in harmonic nature. Is it possible to convert random data into harmonic?
    My end goal is to apply the FFT on the speed vs time data in order to express it into speed vs frequency data so that I can pluck out the dominating frequencies that give out a certain magnitude of speed.

    • @MathiasMagdowski
      @MathiasMagdowski  9 หลายเดือนก่อน

      Thanks for your question. I suggest to plot your time function and thoroughly look at it, zoom in and zoom out. If you observe that it mainly shows noise and random or stochastic fluctuations only, then there is probably no regular or periodic pattern present and no harmonic oscillations occured. Therefore, if you calculate the spectrum of the signal, it will probably also only show noise and no specific resonant frequencies.
      Another thing: When applying the FFT, the longest time in the time range corresponds the the smallest frequency and vice versa, the smallest time corresponds to the highest frequency. So with a total time range of 2900 min = 174 000 s, the smallest frequency in your spectrum will be approximately 5.74 µHz. As your time step is 1 min = 60 s, the highest frequency in the spectrum will be approximately 16.6 mHz. The question is, if this is your frequency range of interest or not. If you are interested in even lower frequencies, you need to sample longer in time domain. If you are interested in higher frequencies, you need to sample faster in time domain.

  • @radon3292
    @radon3292 7 หลายเดือนก่อน +1

    Why not use fft Matlab command?

    • @MathiasMagdowski
      @MathiasMagdowski  7 หลายเดือนก่อน +1

      The 'fft' function (fast Fourier transform or discrete Fourier transform) is used within the 'fourier' function, which works like an API (application programming interface) or a wrapper to the underlying 'fft' function. The problems or issues with the basic 'fft' function are the following:
      1. The 'fft' function only takes one argument as input, the values of the time function, and returns one output variable, the values of the spectrum.
      2. Therefore, you have to take care about the corresponding time steps and frequency values yourself. The highest frequency corresponds to the shortest time, while the smallest frequency corresponds to the longest time. The 'fourier' function takes care of this. As a second input argument, you input corresponding time (equidistant) steps and get back the corresponding (equidistant) frequencies as a second output vector.
      3. The ordering of the frequencies in the output vector of the basic 'fft' function is kind of strange. The first entry in the spectrum obtained by the 'fft' function refers to the doubled constant part of the transient signal. It is followed by the positive frequencies in ascending order up the the highest frequency. Then, there are the negative frequencies in descending order. Negative frequencies only make sense for complex-valued time functions, which usually have no physical meaning in the engineering sciences. For real-valued time functions, the spectrum of the negative frequencies is the complex conjugate of the spectrum of the positive frequencies. Therefore, the negative frequencies can be omitted, as they are redundant and do not contain any relevant information in that case.
      4. The amplitude or magnitude of the spectrum calculated by the basic 'fft' function depends on the number of steps or vector length of the given time function. The wrapper provided by the 'fourier' function takes care of this and renormalizes the amplitude for two different cases, periodic functions (like sums of sine and cosine functions, rectangular pulse trains or clock signals) or aperiodic functions (like single pulses).

    • @radon3292
      @radon3292 7 หลายเดือนก่อน +1

      @@MathiasMagdowski thank you for your prompt and detailed answer!

  • @the_bumm
    @the_bumm ปีที่แล้ว +2

    Impressive video! I’m currently conducting research to explore the relationship between various sizes of compressed air leaks and their corresponding frequency shifts, employing accelerometers for measurement. One notable challenge I’m encountering involves effectively analyzing the FFT spikes amidst the accompanying noise. I’d greatly appreciate your insights on the most effective techniques to mitigate noise in the final FFT results. I am having a difficult time improving the plots with windows and or signal averaging.

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +1

      Noise is a broadband process. Your useful signals are rather narrowband. One of the things to try is to filter your signal for the interesting frequency components and to suppress the unwanted frequencies components including the noise using transfer functions of high-pass, low-pass, band-pass or band-stop filters. You can also try the average your calculated spectra over a certain amount of time as noise will typically cancel out. Nevertheless, if the transient signal in time domain only consists of noise, then the spectrum will also more or less only show noise.

  • @ankitvashistha3
    @ankitvashistha3 29 วันที่ผ่านมา

    I want to club 4 accelerometer data in one graph with respect to time because you have done only 1 accelerometer data vs time. If it is possible please tell me .

    • @MathiasMagdowski
      @MathiasMagdowski  27 วันที่ผ่านมา

      Thanks for your inquiry and sorry for the slightly delayed answer, but I'm currently at a conference.
      Sure you can plot four curves into one joint graph, see the documentation of the plot command. For example, if you have done the FFT analysis four times and correspondingly obtained the frequency vectors f1, f2, f3 and f4 as well as the acceleration spectra A_f1, A_f2, A_f3 and A_f4, you can just plot them into a joined diagram by:
      loglog(f1,abs(A_f1),f2,abs(A_f2),f3,abs(A_f3),f4,abs(A_f4))

  • @berfindurmus9380
    @berfindurmus9380 8 หลายเดือนก่อน +1

    hi tank u for valuable information i use accelerometer and i need to calculate and plot detailed frequency centered distribution can y give me some advices and direction

    • @berfindurmus9380
      @berfindurmus9380 8 หลายเดือนก่อน +1

      Depending on the frequency intensity I want to detect the moments of signal distortion i will use for motors i guees i need to make vibration analysis

    • @MathiasMagdowski
      @MathiasMagdowski  8 หลายเดือนก่อน

      ​@@berfindurmus9380 What do you exactly mean by a "frequency-centered distribution"? Maybe these more general videos are also helpful for you:
      How to do a discrete Fourier transform (FFT) and to plot the amplitude and phase spectrum in MATLAB
      th-cam.com/video/ZvYGqYOyesk/w-d-xo.html
      How to scale the result of the fft (fast Fourier transform) and how does fourier.m work in MATLAB?
      th-cam.com/video/hAbsoXaZ144/w-d-xo.html
      How to reconstruct a periodic signal as a sum of cosine functions from the freq. spectrum in MATLAB
      th-cam.com/video/OvyTRxZSolU/w-d-xo.html

    • @berfindurmus9380
      @berfindurmus9380 8 หลายเดือนก่อน

      @@MathiasMagdowski i will check the contents thank u for feedbacks

    • @MathiasMagdowski
      @MathiasMagdowski  8 หลายเดือนก่อน

      ​@@berfindurmus9380 You are welcome.

  • @AvinashAyyalasomayajula
    @AvinashAyyalasomayajula ปีที่แล้ว +1

    Once we convert a time wave form signal into a FFT spectrum, how can we extract the fewtures from the FFT.

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว

      The question is, what you define as a feature. The spectrum calculated by the FFT algorithm contains the amplitudes and phases of the sinusoidal (or better cosinusoidal) functions that you need to replicate the time function with respect to the different frequencies. You will nicely see if your signal contains only a few certain frequencies or is rather broadband. If the signal or time function is the output of a system, you might also see resonances, natural frequencies or eigenfrequencies of the system. The question remains, what you define as a feature.

  • @mediwise2474
    @mediwise2474 4 หลายเดือนก่อน +1

    Pl help i want yo convwrt vibration damping data in frequency vs amplitude to time domain

    • @MathiasMagdowski
      @MathiasMagdowski  4 หลายเดือนก่อน

      First, please fix your keyboard or use a spell checker. Second, please have a look at this video on how reconstruct a periodic signal as a sum of cosine functions from the corresponding frequency spectrum in MATLAB:
      th-cam.com/video/OvyTRxZSolU/w-d-xo.html
      Please note that this will only work if you have a full complex-valued spectrum given as a real part and imaginary part or by amplitude and phase of all the relevant spectral components. If you just have an amplitude spectrum without any phase information, you cannot usually not fully reconstruct the corresponding time-domain signal.

    • @mediwise2474
      @mediwise2474 4 หลายเดือนก่อน +1

      @@MathiasMagdowski sir is this video enough for conversion

    • @MathiasMagdowski
      @MathiasMagdowski  4 หลายเดือนก่อน

      @@mediwise2474 Is this a question or a statement? In any case, I guess that you will have to find this out yourself for your problem.

    • @mediwise2474
      @mediwise2474 4 หลายเดือนก่อน +1

      @@MathiasMagdowski sir I'm a student of textile science with no knowledge of matlab thqts why asking it sir

    • @mediwise2474
      @mediwise2474 4 หลายเดือนก่อน +1

      @@MathiasMagdowski actually question is is this a procedure to convert frequency domain graph or value of a vibration damping to a time domain sir ?

  • @guenthermeinname7000
    @guenthermeinname7000 ปีที่แล้ว +2

    Hi Mathias,
    danke für das Video!
    Ich untersuche zur Zeit Beschleunigungsdaten von einem Masse-Feder Ersatzmodell, welches durch einen Hammerschlag erregt wird.
    Ich bin vor allem interessiert am Frequenzspektrum. Wenn ich das z.B über FFT oder pwelch plotte (auch mit vorheriger Filterung und Offset-Bereinigung) habe ich einen 0Hz peak und sozusagen ein "Roll-Off" Verhalten von 0Hz aufwärts.
    Also ein bisschen wie in dem Video das Spektrum des Displacements. Haben sie da eine Idee, woran das noch liegen könnte?
    Vielen Dank!

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +2

      Vielen Dank für die Frage und Entschuldigung für die etwas verzögerte Rückmeldung, aber ich war im Urlaub und auf Dienstreise.
      Ohne die konkrete Zeitfunktion zu sehen, sind solche Ferndiagnosen immer etwas schwierig. Ich vermute jedoch, dass es dort eine gewisse langsame Drift gibt, die dann bei tiefen Frequenzen entsprechende Anteile im Spektrum hervorruft.
      Möglicherweise endet die Zeitfunktion auch nicht mit demselben Amplitudenwert, mit dem sie beginnt. Der FFT-Algorithmus geht davon aus, dass die Zeitfunktion zyklisch fortgesetzt wird und sich immer weiter wiederholt, so dass eine quasi-periodische Funktion entsteht. Wenn der Anfangs- und der Endwert nicht gleich sind, gibt es einen großen Sprung oder eine große Stufe, die viele Artefakte im Spektrum erzeugt, die eigentlich nicht vorhanden sind, sondern nur aufgrund dieses Sprungs auftreten. In einem solchen Fall kann es hilfreich sein, die Zeitfunktion und den Anfang oder das Ende abzuschneiden, um die Anfangs- und Endamplitude anzugleichen, oder eine Fensterfunktion zu verwenden (siehe de.wikipedia.org/wiki/Fensterfunktion).

    • @guenthermeinname7000
      @guenthermeinname7000 ปีที่แล้ว +1

      Danke für die Antwort @@MathiasMagdowski!
      Mit Fenstern habe ich bereits viel ausprobiert/gearbeitet, das führt allerdings nicht wirklich zu zufriedenstellenden Ergebnissen.
      Angenommen das Signal ist von langsamen Drifts beeinflusst, wie kann man das untersuchen und unter Umständen "bekämpfen"?

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว

      @@guenthermeinname7000 Einen langsamen Drift oder Trend erkennt man daran, dass sich der Funktionswert neben der Schwingung, die ja eigentlich von Interesse ist, langsam nach "oben oder unten" wegbewegt und eben wegdriftet, so wie hier zu sehen:
      th-cam.com/video/U0qcDyM6e6w/w-d-xo.html
      Ursachen für solche Drifts sind Messfehler, z.B. durch Temperaturänderungen oder Ähnliches.
      Mit Hilfe der ebenso im Video beschriebenen detrend-Funktion in MATLAB kann man solche Trends aus den Daten herausfiltern.

  • @dineshpatel-e6q
    @dineshpatel-e6q 10 หลายเดือนก่อน +1

    Great work, You are helping us.
    Can you provide your codes also?

    • @MathiasMagdowski
      @MathiasMagdowski  10 หลายเดือนก่อน

      Thanks for your inquiry. The MATLAB source code of the example is linked in the video description:
      cloud.ovgu.de/s/iN85Gqs8MJx7dQm

  • @maryclairerabanal267
    @maryclairerabanal267 ปีที่แล้ว +1

    Hello Sir, I have an earthquake vibration data from an accelerometer installed in a building. I'm supposed to get the natural frequency of the structure by doing fft analysis. However, the data seem to be erratic and is far from expected output. Could you please help me? Thank you very much

    • @MathiasMagdowski
      @MathiasMagdowski  ปีที่แล้ว +1

      Thanks for your inquiry. You may send me your data to my e-mail address mathias.magdowski@ovgu.de with a clear description of your exakt problem and I might have a look, but I'm rather busy at the moment.

  • @sudmudmud357
    @sudmudmud357 2 หลายเดือนก่อน +1

    Didn’t understand the reason not to use fft, can you explain please

    • @MathiasMagdowski
      @MathiasMagdowski  2 หลายเดือนก่อน +1

      The 'fft' function (fast Fourier transform or discrete Fourier transform) is used within the 'fourier' function, which works like an API (application programming interface) or a wrapper to the underlying 'fft' function. The problems or issues with the basic 'fft' function are the following:
      1. The 'fft' function only takes one argument as input, the values of the time function, and returns one output variable, the values of the spectrum.
      2. Therefore, you have to take care about the corresponding time steps and frequency values yourself. The highest frequency corresponds to the shortest time, while the smallest frequency corresponds to the longest time. The 'fourier' function takes care of this. As a second input argument, you input corresponding time (equidistant) steps and get back the corresponding (equidistant) frequencies as a second output vector.
      3. The ordering of the frequencies in the output vector of the basic 'fft' function is kind of strange. The first entry in the spectrum obtained by the 'fft' function refers to the doubled constant part of the transient signal. It is followed by the positive frequencies in ascending order up the the highest frequency. Then, there are the negative frequencies in descending order. Negative frequencies only make sense for complex-valued time functions, which usually have no physical meaning in the engineering sciences. For real-valued time functions, the spectrum of the negative frequencies is the complex conjugate of the spectrum of the positive frequencies. Therefore, the negative frequencies can be omitted, as they are redundant and do not contain any relevant information in that case.
      4. The amplitude or magnitude of the spectrum calculated by the basic 'fft' function depends on the number of steps or vector length of the given time function. The wrapper provided by the 'fourier' function takes care of this and renormalizes the amplitude for two different cases, periodic functions (like sums of sine and cosine functions, rectangular pulse trains or clock signals) or aperiodic functions (like single pulses).
      Please also refer to this video:
      How to scale the result of the fft (fast Fourier transform) and how does fourier.m work in MATLAB?
      th-cam.com/video/hAbsoXaZ144/w-d-xo.html
      Does this answer your question?

    • @sudmudmud357
      @sudmudmud357 2 หลายเดือนก่อน +1

      @@MathiasMagdowski yes , thank you so much for your reply.

    • @MathiasMagdowski
      @MathiasMagdowski  2 หลายเดือนก่อน +1

      @@sudmudmud357 No problem, you are welcome.

    • @MathiasMagdowski
      @MathiasMagdowski  2 หลายเดือนก่อน

      @@sudmudmud357 To be honest, I don't have much experience with power spectral density calculations (en.wikipedia.org/wiki/Spectral_density). To check for equidistant time steps (or a constant sampling rate), you can calculate the distance between each time step using diff(t), where t is your vector of time steps. All values of the result of diff(t) should be equal. A graphical representation using plot(diff(t)) should show a horizontal straight line.
      If your time steps are not uniformly spaced, or if the sampling rate is not constant, you would need to interpolate your time function to equidistant time steps before calculating the power spectral density.
      Windowing is only really necessary if your time function does not end at exactly the same amplitude value as it began. The FFT algorithm assumes that the time function continues and repeats over and over, forming a quasi-periodic function. If the start and end values are not the same, there will be a huge jump, or a huge step, which will create a lot of artifacts in your spectrum that are not really there, but are created by that jump. In such a case, it may be helpful to cut the time function and the start or end to make the start and end amplitudes more similar, or to use a windowing function (see en.wikipedia.org/wiki/Window_function). The proper choice of this windowing function depends on the characteristics of the time function and requires a trade-off between artifact suppression and amplitude error.

    • @sudmudmud357
      @sudmudmud357 หลายเดือนก่อน +1

      @@MathiasMagdowski thank you 🙏 very much. What you have mentioned is more than sufficient.

  • @ZachariaszKrawczyk
    @ZachariaszKrawczyk ปีที่แล้ว +2

    Fantastic video thanks a lot for your help

  • @dineshpatel-e6q
    @dineshpatel-e6q 10 หลายเดือนก่อน +1

    You are doing great work ❤,
    Can you make a video for retrieving the mode shape of the beam using contact point response?

    • @MathiasMagdowski
      @MathiasMagdowski  10 หลายเดือนก่อน

      What do you exactly mean by that? Which beam is meant and what is described by its mode shape? What responds to the point contact and how? How is this contact established?

    • @dineshpatel-e6q
      @dineshpatel-e6q 10 หลายเดือนก่อน +1

      @@MathiasMagdowski if we have acceleration response data of beam then how can I plot the mode shape of beam.

    • @MathiasMagdowski
      @MathiasMagdowski  10 หลายเดือนก่อน

      @@dineshpatel-e6q You mean a cantilever beam where one end is fixed, right? For how many points along the deflected cantilever beam do you have acceleration data?

    • @dineshpatel-e6q
      @dineshpatel-e6q 10 หลายเดือนก่อน +1

      @@MathiasMagdowski no for simple supported beam.

    • @MathiasMagdowski
      @MathiasMagdowski  10 หลายเดือนก่อน

      ​@@dineshpatel-e6q You mean a simply supported beam, having two supports at either end - one pinned and one roller? Still, for how many points along the deflected simply supported beam do you have acceleration data? How is the beam excited or how is the vibration generated?