Hello.
How would I make a square wave using a summation of sinusoidal signals as shown in the image below;
Thank you,
Andy.

댓글 수: 3

Star Strider
Star Strider 2021년 4월 6일
It is actually possible to do this in about three lines of code, and no loops.
However that assignment would likely requrie a for loop.
I leave the rest to you.
Andy Stewart
Andy Stewart 2021년 4월 6일
I don't have to use a for loop persay, as it's a tutorial rather than an assignment - Would you be able to elaborate on the code if you have the time?
Thanks again,
Andy.
Star Strider
Star Strider 2021년 4월 6일
My pleasure!
See my Answer.

댓글을 달려면 로그인하십시오.

 채택된 답변

VBBV
VBBV 2021년 4월 6일

0 개 추천

%f true
f = 0.5;
vp = 2;
N = 8;
t = 0:0.01:2;
for k = 1: length(t)
for i = 1:N
K(i,k) = (1/(2*i-1))*(vp*sin(2*pi*(2*i-1)*f*t(k)));
end
KK(k)= (4/pi)*sum(K(:,k));
end
plot(t,KK)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2021년 4월 6일

댓글:

2021년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by