How can I use "impulseest" to recreate the results of the deprecated "impulse" function?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have been using the "impulse" function to calculate impulse responses in the time domain, but I recently switched to R2013a, and I now get this warning when I run my code:
Warning: The use of the "impulse" command on a dataset or FRD model is deprecated. Generate a non-parametric impulse response model from the data using the "impulseest" command. Apply the "impulse" command on the resulting model if required.
I tried to do as the warning suggested, and I rewrote my code to use "impulseest," but I can't recreate the results I got with the deprecated impulse function.
I wrote some code to demonstrate the issue I'm having. I make an input signal of random impulses, create a desired impulse response, and convolve the input with the impulse response to get the output. I then use "impulse" and "impulseest" to try to recover the desired impulse response. You'll see that this does not work with the "impulseest" function.
data_length = 4000; % length of data in samples
impulse_length = 250; % length of fabricated impulse response
fs = 100; % sampling frequency
ni = 20; % number of impulses
time = -(impulse_length/fs/2):(1/fs):(impulse_length/fs/2);
% Create a random distribution of impulses; this will be the input
stimes = round(rand(ni,1)*data_length);
in = zeros(data_length,1);
in(stimes) = 1;
% Create a window, which will be the impulse response we hope to recover
g_win = gausswin(impulse_length+1);
s_win = sin(2*pi*10*(1:(impulse_length+1))/impulse_length+1)';
win = g_win.*s_win;
% Convolve the window with the input to create the output
out = conv(in, win, 'same');
% Use deprecated "impulse" function to calculate impulse response
data = iddata(out, in, 1/fs);
h = impulse(data, [min(time) max(time)]);
[impulse_y1,impulse_t1] = impulse(h, time);
% Use "impulseest" to calculate the impulse response
h2 = impulseest(data,2*max(time)*fs, min(time)*fs);
[impulse_y2,impulse_t2] = impulse(h2, time);
% Plot results
figure; subplot(311); plot(time, win)
title('Fabricated impulse response')
subplot(312); plot(impulse_t1,impulse_y1);
title('Output of impulse function')
subplot(313); plot(impulse_t2,impulse_y2)
title('Output of impulseest function')
Is there some way to choose the parameters for "impulseest" to recover the desired impulse response? I am definitely interested in looking at feedback (values before t=0), and this seems to be part of the problem. Thanks!
0 comentarios
Respuestas (2)
Paul
el 18 de En. de 2014
Editada: Paul
el 18 de En. de 2014
Well, there is impulseestOptions where you can define input offset. I don't know much about this problem so can't help you much more. Although I think 2*max(time)*fs should be [] in impulseest. The options can be set something like this:
opt = impulseestOptions('InputOffset',min(time));
h2 = impulseest(data,opt);
0 comentarios
Ver también
Categorías
Más información sobre Linear Model Identification en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!