How can I plot a square wave in Matlab

 Respuesta aceptada

Star Strider
Star Strider el 30 de Nov. de 2018
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

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Nov. de 2018

Respondida:

el 30 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by