About conversion to dB - matlab

So I have been dealing with the hydrophone data and coding in matlab. I have couple of questions as follows -
1. I read all the .wav files in matlab and trying to compute the Power spectral density using pwelch in matlab which im able to do with ease. My question is conversion to dB. The hydrophone output is in Voltage/Micropascal. So in order to obtain the Power spectral density values in dB do I simply do 120 + 10*log10(Power)? This is what i did and the Power in brackets here is the output of using pwelch and the values are like 10 power of -6..
How do I get sound pressure levels(SPL (dB re 1 micropascal) from the power spectral density values in dB?
How do I chose specific frequency band of interest, say I want to look at power spectral density in the frequency 10 to 12kHz then how do i go about?
Many thanks .

Related

Understanding Decibel in a power spectral density plot

I wanted to plot the spectral content of my EEG data using MNE but I am unable to understand what this graph actually gives. I am having troubles in understanding the y-axis. From what I have gathered so far, a Decibel is calculated "relative" to something. In this case it is amplitude^2 per frequency. I think I am unable to understand what it truly means, and how do I relate it to this definition I found: "When expressing a power ratio, it is defined as ten times the logarithm in base 10. That is, a change in power by a factor of 10 corresponds to a 10 dB change in level."
This figure (reference) has power 20 decibels at 2 Hz, but what does it mean in terms of power/base 10?

How do I model the RF propagation of a custom UWB transmission using MATLAB?

I've successfully plotted the signal strength coverage map for a generic narrow band (read single frequency) horn antenna using MATLAB's in-built functions design(), txsite() and coverage().
MATLAB uses the 'Longley-Rice' propagation model when terrain data is present which I downloaded and introduced using addCustomTerrain().
However, I don't want my antenna to be narrow band operating at a single frequency.
I want to model the coverage map I would get on location with a known ultra-wide band (UWB) transient pulsed signal. I have the time domain E-field of this waveform as well as the FFT and energy spectral density.
My plan was to loop over many tx antennas, each having an operating frequency equal to one of the ~1000 frequency bins in the UWB spectral content and an output power equal to the scaled energy spectral density (ESD) multiplied by the frequency step size (df) and divided by the total time period of the measured pulsed signal (to get power). P = ESD * (df/T).
However, when I ran this looped code, I got:
"Error using em.EmStructures/savesolution
The calculated result is invalid; possible cause is a coarse mesh. Please consider refining the mesh
manually."
I assume this means MATLAB can't model 1000 different antennas on the same exact location.. but any idea on this error?
Is what I'm trying to do possible in MATLAB?
Are there alternative methods?
Thank you for any help in advance!

In MNE-python, why is the power data scale from time-frequency representation (tfr) different from power spectral density (PSD) ?

When I managed my EEG data, the results of mne.time_frequency.tfr_morlet (or the other two methods) were an array of power around 1e-7. When being plotted with dB = 'True', a good graph was got only when the scale of color is around -150 to -200. However, when I did the psd analysis, the power is around 0-40. What made the differences? Besides, I also did time-frequency analysis with eeglab on matlab, the color scale of dB is around -40 to 40. I cannot understand the differences. Who can explain it, thanks.
The tfr of MNE-python
The psd of MNE-python
The tfr of eeglab(matlab)
Your question is "why is the PSD different from the time-frequency power?" The PSD does not report based on time.
The time-frequency analysis shows you WHEN different frequencies appear in your data, whereas the PSD gives you the average power of the frequencies within your epoch. At least, from my understanding.
You added 2 images of tfr output and 1 image of psd output--so I assume you are comparing the 2 tfr outputs to the 1 psd output.

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

Power Spectra density and FFT

I know it may be a basic question but I am having trouble with the limits when applying the fft function in Matlab.
I have a time series from this specifications:
bdf=0.005;
fHighCut=0.2;
maxTime=600;
freq=1/maxTime:df:fHighCut;
w=2*pi*freq;
time=linspace(0,600,length(freq)*10);
My time series lloks like:
The length of it is 400s. I want to create the PSD from it but it appears that I am obtaining the symetric as well like:
with this commands:
timestepFFT=1/time(end);
freqFFT=(1:length(time))*1/time(end);
amplitudeEtaSeries=abs(fft(etaSeries)/length(time));
powerSpectrumEtaSeries=amplitudeEtaSeries.^2/timestepFFT;
powerSpectrumEtaSeries(1)=0;
Can you please help me? THanks
Please read this article. power spectral density calculation by using fft always produce the symmetric PSD. So ignore second half of fft output and details can be found here:
http://www.mathworks.se/help/signal/ug/psd-estimate-using-fft.html