How to calculate integral of a square waveform
11 views (last 30 days)
Show older comments
Ashwini Amin
on 10 Aug 2018
Commented: Ashwini Amin
on 24 Aug 2018
Hi,
Could you please let us know how to calculate integral of a square waveform using Matlab
0 Comments
Accepted Answer
Ameer Hamza
on 10 Aug 2018
You can use the square() function to create a square wave with the time period of 2*pi and amplitude between -1 and 1. And then use trapz() to evaluate the integral numerically. For example
t = 0:0.1:10; %%choose the range you want
y = square(t);
trapz(t,y)
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!