How to generate an impulse sequence

51 次查看(过去 30 天)
I want to generate an impulse sequence or a train of impulse with a frequency of 1.6 Hz with matlab. How can I do that?

采纳的回答

Image Analyst
Image Analyst 2013-12-1
You could create a comb function like this:
% Create 1 second long signal of all zeros.
% Each time element is defined to be 0.000125 second long.
t = zeros(1, 5*1600);
% Create impulses every 0.000625 seconds.
% That would mean it occurs every 5th sample
t(1:4:end) = 1
Of course you can decide however many elements you want to be in a one second span and how narrow your pulses are.
  3 个评论
Image Analyst
Image Analyst 2013-12-2
It's simply just an array. How you interpret it is up to you. If you want it in Hz, fine, it's in Hz. If you want it in the frequency domain, fine, it's in the frequency domain. Nothing to do at all except in how you interpret it - the array can stay the same, it's just that the meaning of one element to the next means some thing different. It's in seconds or milliseconds, or in Hz or whatever. It's however you want to interpret it.
ismail ismail
ismail ismail 2021-1-31
How to generate a signal Dirac (t-3) using Zeros function Matlab

请先登录,再进行评论。

更多回答(1 个)

MD Rasel Basunia
MD Rasel Basunia 2022-4-8
%% Creating a impulse train
f=10;% frequency of impulse
fs=4*f;% sampling frequency with oversampling factor
Ts=1/fs;% sampling interval or period
t=-25:Ts:25;% Time range for impulse train
% creating impulse function
x=@(t) (t==0)
%% Method 1
xshift = x(t)+x(t-1)+ x(t+1)+x(t-2)+x(t+2);
subplot(311)
stem(t,xshift,'^','linewidth',2);grid on;ylim([0 2]);
xlabel('Time(sec)');ylabel('Amplitude');
title('shifted impulse with origin');
%% Method 2
xshift = @(t) x(t)+ x(t-1)+x(t+1)+x(t-2)+x(t+2)
subplot(312)
stem(t,xshift(t),'r','^','linewidth',2);grid on;
xlabel('Time(sec)');ylabel('Amplitude');
title(' Using Annonimous function');ylim([0 2]);
%% impulse train
sum=zeros(size(t))
for k = -25:25
sum = sum+x(t-k)
end
subplot(313)
stem(t,sum,'^','linewidth',2);grid on;xlabel('Time(sec)');
ylabel('Amplitude');
title('Impulse Train ');ylim([0 2]);
%% completed
%% Output :

类别

Help CenterFile Exchange 中查找有关 Parametric Spectral Estimation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by