Borrar filtros
Borrar filtros

How to generate an impulse sequence

43 visualizaciones (últimos 30 días)
Nastaran
Nastaran el 1 de Dic. de 2013
Respondida: MD Rasel Basunia el 8 de Abr. de 2022
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?

Respuesta aceptada

Image Analyst
Image Analyst el 1 de Dic. de 2013
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 comentarios
Image Analyst
Image Analyst el 2 de Dic. de 2013
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 el 31 de En. de 2021
How to generate a signal Dirac (t-3) using Zeros function Matlab

Iniciar sesión para comentar.

Más respuestas (1)

MD Rasel Basunia
MD Rasel Basunia el 8 de Abr. de 2022
%% 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 :

Categorías

Más información sobre Signal Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by