Band Periodicity - matlab

this is one of sounds features and it has been used in some AI voice app.
"The periodicity property of each sub-band is represented by the maximum
local peak of the normalized correlation function."
I can't understand the way to calculate it, any help will be appreciated
any law to find "normalized correlation" and "maximum local peak" .
in my law i cant understand what "s(n)" value.
I need a "s(n)" explanation so i can build a function using matlab , or a clearer law..
please if u don't have an idea about band periodicity don't try to searcher about it,there is nothing on the internet!

s(n) is just the sample at index n of the signal after bandpass filtering.

Related

Calculation of the diffusion/activation energy

I am currently attempting to do a KMC simulation to calculate the diffusion coefficient of an Inconel-Ni alloy using LAMMPS. As a part of that, I would like to know how to calculate, in LAMMPS preferably (or in any other way), the diffusion/activation energy that is taken or expended by all the atoms at any given timestep in the model when they diffuse from their current atomic site to a new atomic site. I cannot use the Arrhenius equation since my objective is to calculate the diffusion coefficient 'D' and both D and activation energy 'E_a' are unknown. Could anyone provide any insight into this? Thank you.
Regards,
Rajesh

Given a Cost Function, C(weights), that depends on expected and network outputs, how is C differentiated with respect to weights?

I'm building a Neural Network from scratch that categorizes values of x into 21 possible estimates for sin(x). I plan to use MSE as my loss function.
MSE of each minibatch = ||y(x) - a||^2, where y(x) is the vector of network outputs for x-
values in the minibatch. a is the vector of expected outputs that correspond to each x.
After finding the loss, the column vector of all weights in the network is recalculated. Column vector of delta w's ~= column vector of partial derivatives of C with respect to each weight.
∇C≡(∂C/∂w1,∂C/∂w2...).T and Δw =−η∇C where η is the (positive) learn rate.
The problem is, to find the gradient of C, you have to differentiate with respect to each weight. What does that function even look like? It's not just the previously stated MSE right?
Any help is appreciated. Also, apologies in advance if this question is misplaced, I wasn't sure if it belonged here or in a math forum.
Thank you.
(I might add that I have tried to find an answer to this online, but few examples exist that either don't use libraries to do the dirty work or present the information clearly.)
http://neuralnetworksanddeeplearning.com/chap2.html
I had found this a while ago but only now realized it's significance. The link describes δ(j,l) as an intermediary value to arrive at the partial derivative of C with respect to weights. I will post back here with a full answer if the link above answers my question, as I've seen a few posts similar to mine that have yet to be answered.

Parameter estimation (MLE) of a truncated Pareto distribution

i'm new here and i am super desperate so i really hope anyone of you can help me....
i have a sample of random data x_1....x_n and i want to fit a truncated pareto distribution to the data.... to fit a generalized pareto distribution is super easy and i have already done that. I calculated the shape and scale parameters with a matlab routine.
But for the truncated pareto distribution i can't seem to find a routine to calculate the parameters i need...
Does anybody have an idea how to do it?
Thanks in advance!
You can use Markov-Chain-Monte-Carlo simulations to do Bayesian Inference to get the most likely parameters of your generalized pareto distribution for the given data. Or you stay with the maximum likelihood method. Your problem can be solved in many ways. But if you want to apply MLE you actually just need to search for a maximum. You could do it with fminsearch()
http://de.mathworks.com/help/optim/ug/fminsearch.html
For this you just need to define another function in a separate m-file which computes your Likelihood or Log-Likehood for a given set of parameters of your truncated pareto distribution. fminsearch now returns you the optimal parameters according to this likelihood. Is this the kind of routine you are looking for?

how to find the similarity between two curves and the score of similarity?

I have two data sets (t,y1) and (t,y2). These data sets visually look same but their is some time delay or magnitude shift. i want to find the similarity between the two curves (giving the score of similarity 1 for approximately similar curves and 0 for not similar curves). Some curves are seem to be different because of oscillation in data. so, i am searching for the method to find the similarity between the curves. i already tried gradient command in Matlab to find the slope of the curve at each time step and compared it. but it is not giving me satisfactory results. please anybody suggest me the method to find the similarity between the curves.
Thanks in Advance
This answer assumes your y1 and y2 are signals rather than curves. The latter I would try to parametrise with POLYFIT.
If they really look the same, but are shifted in time (and not wrapped around) then you can:
y1n=y1/norm(y1);
y2n=y2/norm(y2);
normratio=norm(y1)/norm(y2);
c=conv2(y1n,y2n,'same');
[val ind]=max(c);
ind will indicate the time shift and normratio the difference in magnitude.
Both can be used as features for your similarity metric. I assume however your signals actually vary by more than just timeshift or magnitude in which case some sort of signal parametrisation may be a better choice and then building a metric on those parameters.
Without knowing anything about your data I would first try with AR (assuming things as typical as FFT or PRINCOMP won't work).
For time series data similarity measurement, one traditional solution is DTW (Dynamic Time Warpping)
Kolmongrov Smirnov Test (kstest2 function in Matlab)
Chi Square Test
to measure similarity there is a measure called MIC: Maximal information coefficient. It quantifies the information shared between 2 data or curves.
The dv and dc distance in the following paper may solve your problem.
http://bioinformatics.oxfordjournals.org/content/27/22/3135.full

Designing a simple bandpass/bandstop filter in Matlab

For a homework assignment I have to design a simple bandpass filter in Matlab that filters out everything between 250Hz and 1000 Hz. What I did so far:
- using the 'enframe' function to create half overlapping windows with 512 samples each. On the windows I apply the hann window function.
- On each window I apply an fft. After this I reconstruct the original signal with the function ifft, that all goes well.
But the problem is how I have to interpret the result of the fft function and how to filter out a frequency band.
Unless I'm mistaken, it sounds like you're taking the wrong approach to this.
If your assignment is to manipulate a signal specifically by manipulating its FFT then ignore me. Otherwise.. read on.
The FFT is normally used to analyse a signal in the frequency domain. If you start fiddling with the complex coefficients that an FFT returns then you're getting into a complicated mathematical situation. This is particularly the case since your cut-off frequencies aren't going to lie nicely on FFT bin frequencies. Also, remember that the FFT is not a perfect transform of the signal you're analysing. It will always introduce artefacts of its own due to scalloping error, and convolution with your hann window.
So.. let's leave the FFT for analysis, and build a filter.
If you're doing band-pass design in your class I'm going to assume you understand what they do. There's a number of functions in Matlab to generate the coefficients for different types of filter i.e. butter, kaiser cheby1. Look up their help pages in Matlab for loads more info. The values you plug in to these functions will be dependent on your filter specification, i.e. you want "X"dB rolloff and "Y"dB passband ripple. You'll need some idea of the how these filters work, and knowledge of their transfer functions to understand how their filter order relates to your specification.
Once you have your coefficients, it's just a case of running them through the filter function (again.. check the help page if you're not sure how this works).
The mighty JOS has a great walkthrough of bandpass filter design here.
One other little niggle.. in your question you mentioned that you want your filter to "filter out" everything between 250Hz and 1000Hz. This is a bit ambiguous. If you're designing a bandpass filter you would want to "pass" everything between 250Hz and 1000Hz. If you do in fact want to "filter out" everything in this range you want a band-stop filter instead.
It all depends on the sampling rate you use.
If you sample right according to the Nyquist-Shannon sampling theorem then you can try and interpret the samples of your fft using the definition of the DFT.
For understanding which frequencies correspond with which samples in the dft results, I think it's best to look at the inverse transformation. You multiply coefficient k with
exp(i*2*pi*k/N*n)
which can be interpreted to be a cosine with Euler's Formula. So each coefficient gets multiplied by a sine of a certain frequency.
Good luck ;)