En este tutorial, escribiremos la serie de Fourier de una función simple usando Matlab.
Supongamos que tenemos una onda cuadrada con las siguientes características:
$begin{align} & Período=2ms & Pico a picotext{ }Valor=2text{ }V & Promediotext{ }Valor=0text{ }V end {alinear}$
Entonces, podemos expresarlo así:
[begin{align} & x Resultados:
%% Parameters as mentioned in text
f = 500; % Frequecny
C = 4/pi; % Constant Value
dt = 5.0e-05; % Interval between teo time steps
tpts = (4.0e-3/5.0e-5) + 1; % Total points "(final point-initial point)/Interval+1%
for n = 1: 12 % Values we are considering to approximate Fourier Seires instead of infinity as given in original function x
for m = 1: tpts % Here, we'll consider all "t" points to cover "from 0 to 4ms interval"
s1(n,m) = (4/pi)*(1/(2*n - 1))*sin((2*n - 1)*2*pi*f*dt*(m-1)); % Approximate Fourier Series g
end
end
for m = 1:tpts
a1 = s1(:,m); % VERY IMPORTANT ! Here, we are assigning a1 for each single column (total 81)
a2(m) = sum(a1); % Here, we are summing up the whole column to one single value (adding all 12 values in one column)
end
% Now, we have a row vector "a2" with total values "81"
f1 = a2'; % Here, we have final values "f1" (total 81 points) as transpose of a2 computed above
t = 0.0:5.0e-5:4.0e-3; % it's already given in text (0 to 4ms with interval of 0.05 ms)
%% Plotting results
plot(t,f1)
xlabel('Time, s')
ylabel('Amplitude, V')
title('Fourier Series Expansion')
Higo. 1: serie de Fourier de onda cuadrada
- También puedes leer: Serie Exponencial de Fourier con ejemplo resuelto
¡Más Contenido!