finding a changing dominant tone in a signal

1 view (last 30 days)
wouter koomen
wouter koomen on 24 Feb 2016
Commented: wouter koomen on 26 Feb 2016
For my Thesis I am analysing aircraft noise, in here a fan tone is visible when creating a spectrogram, however after removing background noise by removing a large moving average form the original. When searching for peaks in a small time bin, 100ms, the remaining found peaks are still quite noisy.
A different approach was for every 100ms, get the corresponding samplepoints, use a bandpass filter so only the intersing part is left, where the fan tone is expected and fititng that to a sin and using the non lineair optimization toolbox in matlab to find the optimum. However, if I want to do this automatically, so using code, the fit is not as good as my starting points dont change. When doing it manually these points get chosen by matlab, and those are optimized starting points. Is there any way to change the mode in my code to make matlab determine optimal values? Instead of the hard coded number array I am using at the moment?

Answers (1)

Kevin Claytor
Kevin Claytor on 24 Feb 2016
Have you tried:
Raw data -> BP filter -> Spectrogram -> peak finding
You seem to have the parts for it, and I would expect it to be faster than nonlinear fitting.
But if you're dead-set on fitting instead, most of the fitting routines have the option for initial parameters. For example, when using fit from the CF toolbox, you can use fitOptions to specify your initial parameters, which can be drawn from the data programatically;
frequency = fan_freq;
f_low = 0.8*frequency;
f_high = 1.2*frequency;
amplitude = max(data) - min(data);
a_low = 0.8*amplitude;
a_high = 1.2*amplitude;
phase = ...
fo = fitoptions('Startpoint', [frequency, amplitude, phase],...
'Lower', [f_low, a_low, p_low],...
'Upper', [f_high, a_high, p_high]);
ft = fittype('a*sin(f*x +p)', 'independent', {'x'}, 'coefficients', {'f', 'a', 'p'}, 'options', fo)
fit(x, data, ft)
Just make sure to match the order of 'coefficients' to the order in 'startpoints', 'lower', and 'upper'.
  2 Comments
wouter koomen
wouter koomen on 26 Feb 2016
alright it seems commenting or removing the startpoint from the code solves my problem and the alternative way works as well.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!