필터 지우기
필터 지우기

How to generate an impulse sequence

조회 수: 43 (최근 30일)
Nastaran
Nastaran 2013년 12월 1일
답변: MD Rasel Basunia 2022년 4월 8일
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에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by