How do I generate the described pulse signal?

I want to implement the following signal:
I(t) = 500*(sin(pi.t/0.3))^2, % if t belongs {0,Ts}
= 0, % if t belongs {Ts,T}
Here, T = 0.8 and Ts = 0.3
The code I tried:
t = 0 : 0.001 : 25;
d = 0 : 0.8 : 25;
y = pulstran(t,d,'rectpuls',0.3);
ut = 500.*((sin(pi*t/0.3)).^2).*y;
plot(t,ut)
xlabel 'Time (s)', ylabel Waveform
Expected input waveform:
The waveform generated by my code is showing several aberrations, such as multiple peaks.

Answers (1)

Your t goes from 0 to 25, and your sine wave period is 0.3/2 = 0.15, so of course there will be multiple peaks - around 25/.15 = 166 of them. Why do you think there should not be multiple peaks?

Tags

Asked:

on 23 Aug 2016

Answered:

on 27 Aug 2016

Community Treasure Hunt

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

Start Hunting!