How do I generate the described pulse signal?

1 次查看(过去 30 天)
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.

回答(1 个)

Image Analyst
Image Analyst 2016-8-27
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?

标签

Community Treasure Hunt

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

Start Hunting!

Translated by