How can I plot a square wave in Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello
As attached the square wave equation.
How can I plot it ?
댓글 수: 0
채택된 답변
Star Strider
2018년 11월 30일
Try this:
f = 5; % Frequency
N = 16; % Order Of Harmonics
t = linspace(0, 4, 500); % Time Vector
sqwv = @(f,t,n) 4*sum(bsxfun(@rdivide, sin(2*pi*(1:2:N)'*t), (1:2:N)'))/pi;
figure
plot(t, sqwv(f,t,N))
grid
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!