# Square Pulse Generator with Varying Amplitude

6 Ansichten (letzte 30 Tage)
Mohsen am 26 Jul. 2011
Kommentiert: Sena Koçak am 12 Jan. 2022
I am modeling a system using Simulink.
I need to make the input of the system a series of pulses (non periodic). Each pulse has a different amplitude.
For example, the first pulse has an amplitude of 5 ; the 2nd: 3 ; the 3rd: 10 ; the 4th: 1 ; the 5th: 20 ; etc.
I though that I should make a gain matrix and multiply it by the input pulse generator but it doesn't seem to work...
Any idea how to solve this?
Thanks!
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Sena Koçak am 12 Jan. 2022

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Fangjun Jiang am 26 Jul. 2011
If the pulse is non periodic, how do you use Pulse Generator block?
One solution is to use the Signal Builder block, you can add the pulse any way you like.
Construct variable t and y in workspace like below:
t=[0:11;1:12];
t=t(:);
y=repmat([0 0 1 1],1,6);
Then in Signal Builder block, select menu Signal>New>Custom..., put in t and y, and then you can drag the pulse to adjust the amplitude.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Mohsen am 26 Jul. 2011
Thanks!

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Sources 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!

Translated by