필터 지우기
필터 지우기

generation of impulse sequences

조회 수: 3 (최근 30일)
Farideh Jalali
Farideh Jalali 2012년 7월 31일
How can I generate 100 impulse sequence with various amplitude?I need to generate 5 period of these impulse sequences.

답변 (2개)

Ryan G
Ryan G 2012년 7월 31일
If the pulse frequency is consistent you can use a pulse generator multiplied by a scheduled gain for each pulse. You could use a lookup table and set the input to change the gain with time utilize a counter based on rising edges to look them up.
The other option could be to pre-define the pulses in the workspace and use a from workspace block or an inport.

Azzi Abdelmalek
Azzi Abdelmalek 2012년 7월 31일
편집: Azzi Abdelmalek 2012년 7월 31일
nb=100 % number of amplitudes, for better illustration,put nb=10;
n=5;ts=0.1 % ts sample tim
width=5; %width: width of the pulse=0:ts:(width-1)*ts
interval_0=15; % the interval where the signal is zero=(interval_0-1)*ts
y1=[ones(width,nb*n);zeros(interval_0,nb*n)];
amplitude=1:nb; %in this example amplitudes are 1,2,...nb
amp=bsxfun(@times, ones(nb,5),amplitude');
y2=bsxfun(@times, amp(:)',y1);plot(y2(:))
result=y2(:);t=0:ts:(length(result)-1)*ts;close;plot(t,result);
%if you want use it in simulink
tresult =[t;result'];save filname tresult
%and use a block "from file"
  댓글 수: 2
Farideh Jalali
Farideh Jalali 2012년 8월 1일
Can you please much more clarified y2?
Azzi Abdelmalek
Azzi Abdelmalek 2012년 8월 1일
% y2 is a matrix with (5+15)lines and (100*5)columns
% the first column contain 5 "1" multiplied by your first gain and 15
% zeros; the second column contain 5 "1" multipied by your second gain and
% 15 "zeros"., ... the hundredth column contains 5 "1" multiplied by your
% hendredth gain and 15 0. for column 101 , it's the same as column1, and so.;
% y2(:) allows to create one vector containiing all columns of y2
% for better illustration run a program for nb=10; and then check a matrix
% y(2).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by