Generating Triangular wave in simulink

I have sine wave bx is simulink,is there any box for triangular wave available,else please tell how to generate triangular wave in simulink of equal amplitude and time

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 8 日

0 投票

generate your signal in matlab command then use a from workspace block with variable name ty
ts=0.1;
t=-3:ts:3
y=repmat(max(t)-abs(t),1,10)
t=-3:ts:-3+length(y)*ts-ts
ty=[t' y']

6 件のコメント

kash
kash 2012 年 10 月 8 日
Thanks Azzi ,in that i get a amplitude of 2.5 and time is 6 can u please tell how to adjust the amplitude ans time to 2 please
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 8 日
編集済み: Azzi Abdelmalek 2012 年 10 月 8 日
ts=0.1;tim=2
t=-tim:ts:tim
y=repmat(max(t)-abs(t),1,10)
t=-tim:ts:-tim+length(y)*ts-ts
ty=[t' y']
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 8 日
編集済み: Azzi Abdelmalek 2012 年 10 月 8 日
if you want insert zeros between triangles
ts=0.1;tim=2;perc=0.5 %perc >0
t=-tim:ts:tim
y=repmat([max(t)-abs(t) zeros(1,ceil(length(t)*perc))],1,10)
t=-tim:ts:-tim+length(y)*ts-ts
plot(t,y)
ty=[t' y']
kash
kash 2012 年 10 月 8 日
thanks Azzi final question can we use repeating sequence block as a triangular wave
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 8 日
yes you can
JohnLio
JohnLio 2013 年 12 月 6 日
Azzi Abdelmalek: i didn't get how you did that, can you please elaborate a bit how to and which block i have to use in matlab, and where to put these code, newbie in matlab :|

サインインしてコメントする。

その他の回答 (3 件)

Julien
Julien 2012 年 10 月 7 日
編集済み: Julien 2012 年 10 月 7 日

0 投票

Hi, the triangle generator does not exist but you can create your own.
My tip is to create a pulse signal (pulse width =50%) and adding a negative offset (typically the half of the amplitude you want).
If you want a triangle signal between [0 1] then you have to set:
pulse amplitude : 4 offset : -2
Then you have a pulse varying between [-2 2] You just have to integrate this signal and you will get a nice triangle signal varying between [0 1] ;)

4 件のコメント

kash
kash 2012 年 10 月 8 日
Thanks Julien as i am new to simulink can u please tell how to create a pulse signal (pulse width =50%) and adding a negative offset (typically the half of the amplitude).
kash
kash 2012 年 10 月 8 日
Julien can u please model
Julien
Julien 2012 年 10 月 8 日
Contact me in my personal address then I'll can send you the file
Sara
Sara 2013 年 5 月 7 日
how can i get a triangular wave varying from -ve value to a +ve value??

サインインしてコメントする。

Julien
Julien 2012 年 10 月 8 日

0 投票

10 件のコメント

kash
kash 2012 年 10 月 9 日
Thanks a lot julien but can u tel how u got this block plz
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 9 日
right click on the model then click 'look under mask'
kash
kash 2012 年 10 月 9 日
ok Azzi thanks can u tell how to generate a multicarrier Input with 5 triangular wave and a sivewave over it
kash
kash 2012 年 10 月 9 日
in the link
is triangle block in that image is same as a triangle block given bt Julien
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 9 日
yes
kash
kash 2012 年 10 月 9 日
ok Azzi i did as per it but not getting 5 triangular wave on each axes and a sine wave over it
kash
kash 2012 年 10 月 9 日
i have given image for 15 level ,same as it like i need for 7 level
plz help
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 9 日
I did'nt understand. You still have problem with generating triangular wave?
kash
kash 2012 年 10 月 9 日
not in triangular wave i added 5 triangular and a sine wave to get the desired output as above ,but not getting the answer
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 9 日
If you have another problem, I suggest to post another question

サインインしてコメントする。

Vijay P
Vijay P 2018 年 5 月 3 日

0 投票

Please guide me how to do in simulink.

タグ

質問済み:

2012 年 10 月 7 日

回答済み:

2018 年 5 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by