Random pulse generator
Ältere Kommentare anzeigen
Hello,
I'm new in Simulink and i trying to make a pulse random generator. Pulses have amplitude (+10 & -10) and width (1 ms). The signal has to be non periodic, i mean, pulses has to appear by a random series. how can i do it? I apprecitate any help. The begining of my project depend of this signal.
Thanks. Néstor.
3 Kommentare
Azzi Abdelmalek
am 27 Okt. 2012
Bearbeitet: Azzi Abdelmalek
am 27 Okt. 2012
What is the maximale distance between two impulses?
Néstor Monedero
am 29 Okt. 2012
Azzi Abdelmalek
am 29 Okt. 2012
Check the second image (modified)
set the Amplitude of the pulse generator to 2 and substract 1
Akzeptierte Antwort
Weitere Antworten (2)
Fangjun Jiang
am 19 Okt. 2011
1 Stimme
Go to Simulink Sources library, there is the Random Number block and the Uniform Random Number block.
The output of the Uniform Random Number is between 0 and 1, so you'll need to use Relational Operator block to compare it with constant such as 0.1 and 0.9, and then use Switch block to output the +10 or -10 or 0 pulse value.
3 Kommentare
Néstor Monedero
am 21 Okt. 2011
Fangjun Jiang
am 21 Okt. 2011
You can compare the random number with a constant, e.g. 0.9 and then add a zero-order holder block.
Fangjun Jiang
am 28 Nov. 2011
See update.
Néstor Monedero
am 28 Nov. 2011
2 Kommentare
sneha j
am 3 Mai 2021
hi, there is a bug in ur code.
In the case that u(i)<-0.9, y(i) sets to -1 in the first if-block.
But wen it executes the 2nd if-block - if gets overwritten by y(i)=0 as u(i)<0.9, so it executes the else part of the block.
U need to club the the first if block with the 2nd if-else block into one if block as follows:
if(u(i)<-0.9)
y(i)=-1;
else if(u(i)>0.9)
y(i)=1;
else
y(i)=0;
end
Hope it works well.
sneha j
am 3 Mai 2021
hi Nestor, sorry i jus realised that the else if block doesnt work, so here is a workaround:
if(u<-0.5)
y=-10;
else
y=0;
end
if(u>0.5)
y=10;
end

Kategorien
Mehr zu Sources finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

