Skip to content

Instantly share code, notes, and snippets.

@stivio00
Created September 20, 2011 03:11
Show Gist options
  • Save stivio00/1228227 to your computer and use it in GitHub Desktop.
Save stivio00/1228227 to your computer and use it in GitHub Desktop.
Matlab stuff
function y = f(x,m)
% f esta funcion la funcion impulso rectangulo respresentado en sus serie
% de fourier y consta de M componentes, para llamar esta funcion f(x,m)
% donde x es el valor en la funcion y m el numero de componentes.
% Si quiere ver la funcion con sus cuatros componentes seria f(x,4)
% ejemplo, para graficar con 4 componentes:
% x = 0: .001 : 10;
% plot(x, f(x,4);
y = 0;
for i =1:m
y = y + 4/pi * (sin((2*i-1)*x)./(2*i-1));
end
end
% un test para la consola en matlab
% >> x = 0:.001:10;
% >> for i = 1:5
% >> figure
% >> plot(x,f(x,i));
% >> end
%este test graficara diferentes graficas observando la convergencia de la
%serie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment