Earthquake simulation - finite elements method (Matlab) - matlab

do you know is there's a way to simulate a earthquake with the finite elements method using the Partial Differential Equation Toolbox on Matlab ?
My goal is to visualize the amplitude of a (Rayleigh) wave in all points of a forest for different frequencies. And if possible to see what are the modes of vibration of the trees.
Maybe this is a silly question but I'm getting started.
Thanks !

Related

Fourier transform and filtering the MD trajectory data instead of PCA for dimensionality reduction?

I was using PCA for dimensionality reduction of MD (molecular dynamics) trajectory data of some protein simulations. Basically my data is xyz coordinates of protein atoms which change with time (that means I have lot of frames of this xyz coordinates). The dimension of this data is something like 20000 frames of 200x3 (atoms by coordinates). I implemented PCA using princomp command in Matlab.
I was wondering if I can do FFT on my data. I have experience of doing FFT on audio signals (1D signal). Here my data has both time and space in picture. It must be theoretically possible to implement FFT on my data and then filter it using a LPF (low pass filter). But I am unsure.
Can someone give me some direction/code snippets/references towards implementing FFT on my data?
Why people are preferring PCA more often compared to FFT and filtering. Is it because of computational efficiency of algorithm or is it because of the statistical nature of underlying data?
For the first question "Can someone give me some direction/code snippets/references towards implementing FFT on my data?":
I should say fft is implemented in matlab and you do not need to implement it by your own. Also, for your case you should use fftn (fft documentation)to transform and after applying lowpass filtering by dessignfilt (design filter in matalab), the apply ifftn (inverse fft in matlab)to inverse the transform.
For the second question "Why people are preferring PCA more often compared to FFT and filtering ...":
I should say as the filtering in fft is done in signal space, after filtering you can't generalize it in time space. You can more details about this drawback in this article.
But, Fourier analysis has also some other
serious drawbacks. One of them may be that time
information is lost in transforming to the frequency
domain. When looking at a Fourier transform of a
signal, it is impossible to tell when a particular event
has taken place. If it is a stationary signal - this
drawback isn't very important. However, most
interesting signals contain numerous non-stationary or
transitory characteristics: drift, trends, abrupt changes,
and beginnings and ends of events. These
characteristics are often the most important part of the
signal, and Fourier analysis is not suitable in detecting
them.

Plotting Acoustic Waveform - Magnitude on a Linear Frequency Scale

I have an acoustic waveform of a Spanish phoneme and I'd like to compute its magnitude spectrum and plot it in dB magnitude on a linear frequency scale. How would I be able to accomplish this in MATLAB?
Thanks
First a quick heads up: At stackoverflow you are expected to show some of your own efforts to solve the problem and then ask for help.
Now to your question:
You can plot the spectrogram using the "spectrogram" Matlab function.
[s,f,t] = spectrogram(x,window,noverlap,f,fs)
Check the details here: https://www.mathworks.com/help/signal/ref/spectrogram.html
For a speech signal you will want to specify the sampling frequency "fs" (you can get that when you read the file using:
[y,Fs] = audioread(filename)
You will probably want to specify the variables "window" and "noverlap" since speech signals can show distinct properties depending on the dimension of the window (fast phenomena will not be visible on big windows ). A typical values are 20ms windows with 10ms overlap (select the best value by considering your sampling frequency and the nearest 2^n value for fast Fourier calculation).
The window size and overlap are also valid when you calculate spectrum. If you apply FFT to the whole waveform then you will get the "average" spectral information for the sentence. To catch specific phenomena you must use windowing techniques and perform a short-term Fourier analysis.
use sptool
Signal Processing toolbox Show its Document

MATLAB - Wavelet coefficient based QRS complex classifier

I am new to Wavelet field and I wanted to ask you for a help for an idea.
I am supposed to create QRS complex (certain part of ECG signal wave) wave morphology classifier based on Wavelets in other words, I am supposed to create classifier which will separate waves with similar wave shape to categories, like bins in statistics, but based on signal wavelet coefficients.
I tried MATLAB mdwtdec and used wavelet coefficients on certain level as an input for classifier which calculates distance from each QRS and according to threshold separates to classes.
This approach is rather naive and I guess in order to improve it, I need some other idea or hint.

explanation of periodogram in layman's terms (or at least in a very simple way)

Could you please explain to me what a periodogram is and it's physical significance in a very basic and simple way?
I was looking at the figures in this document (At page 5). What is it's difference from the magnitude plot of a Fourier transform?
Is there any relationship between periodogram and spectrogram?
Can I have a very simple example using periodogram function of matlab as well?
Thank you
A periodogram is a method of calculating the power spectral density (PSD) of a signal. A simple periodogram involves dividing the data into windows and computing the PSD of each window, then taking the mean of these individual PSDs. Why? A raw PSD is a poor estimate in the statistical sense (chi-squared distribution? I suggest you check Bendat & Piersol). A simple periodogram fixes this issue but doesn't solve spectral leakage which can be fixed by certain types of windows (e.g. Hanning). I'm just scratching the surface...there are different algorithms to compute it - Welch and Blackman-Tukey for example.
In case you're wondering what a PSD is exactly:
Say you have a signal x(t) = (some noise component)*(sinusoid with frequency f). The power spectral density (usually Power/Hz vs frequency, on a log-log plot) of this signal will have a peak at the frequency f. It is useful for identifying frequency content in a signal.
Matlab has a built in periodogram function periodogram for your reference.
A spectrogram is a time-domain representation of the spectral density. At one time the signal might have stronger frequency content than at another time.

Power spectrum from autocorrelation function with MATLAB

I have some dynamic light scattering data. The machine pumps out the autocorrelation function, and a count-rate.
I can do a simple fit to the ACF
ACF = exp(-D*q^2*t)
and obtain the diffusion coefficient.
I want to obtain the same D from the power spectrum. I have been able to create a power spectrum in two ways -- from the Fourier transform of the ACF, and from the count rate. Both agree, but the power spectrum does not look like in the one in the books, so I'm not sure how to use it to work out the line width.
Attached is an image from a PDF that shows what you should get, and what I get from MATLAB. Can anyone make sense of whats going on?
I have used the code of answer #3 on this question. The resulting autocorrelation comes out exactly the same as
the machine gives me and
using MATLAB's autocorr command on the photoncount data.
Thank you for your time.
When you compute the Fourier transform from short sequences of data it often looks very noisy. There are a number of reasons for this. One reason is that the statistics of individual Fourier components are not Gaussian, and so averaging the spectra across multiple samples of data will only slowly improve the quality of the estimate.
Another causes of "noisiness" in empirical spectra behavior is that you are applying (to a finite data sample) a transform which involves a pathological sinc function and which assumes an infinite length signal. To diminish this problem, it helps to apply a "windowing-function" to your data before computing the Fourier transform. One of the more complicated but also more powerful windowing approaches is the use of so-called 'Slepian tapers'.
MATLAB conveniently implements well-known windows in functions such as hamming and hann.