Square Wave from Sine Waves

10 visualizaciones (últimos 30 días)
Andy Stewart
Andy Stewart el 6 de Abr. de 2021
Comentada: Andy Stewart el 6 de Abr. de 2021
Hello.
How would I make a square wave using a summation of sinusoidal signals as shown in the image below;
Thank you,
Andy.
  3 comentarios
Andy Stewart
Andy Stewart el 6 de Abr. de 2021
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 el 6 de Abr. de 2021
My pleasure!
See my Answer.

Iniciar sesión para comentar.

Respuesta aceptada

VBBV
VBBV el 6 de Abr. de 2021
%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)
  1 comentario
Andy Stewart
Andy Stewart el 6 de Abr. de 2021
Thank you for your help,
Cheers,
Andy.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by