generation of impulse sequences
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
How can I generate 100 impulse sequence with various amplitude?I need to generate 5 period of these impulse sequences.
0 Kommentare
Antworten (2)
Ryan G
am 31 Jul. 2012
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.
0 Kommentare
Azzi Abdelmalek
am 31 Jul. 2012
Bearbeitet: Azzi Abdelmalek
am 31 Jul. 2012
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 Kommentare
Azzi Abdelmalek
am 1 Aug. 2012
% 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).
Siehe auch
Kategorien
Mehr zu Pulsed Waveforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!