フィルターのクリア

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 Center および File ExchangeSignal Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by