Sie sind auf Seite 1von 5

pi=3.

14159; A=2; % amplitud T=1; % periodo w0=2*pi/T; % frecuencia fundamental, rad/s tf=2*T; % tiempo final dt=tf/200; % incremento del tiempo t=0:dt:tf; % tiempo a0=A/2; % valor de a0 v1=a0; % initialize input as vector for n=1:1:51 % for each term in the Fourier series ... an=0; % specify coefficients of the input series bn=A/(pi*n); cn=sqrt(an*an + bn*bn); % convert to magnitude and angle form thetan=-atan2(bn,an); v1=v1+cn*cos(n*w0*t+thetan); % add the next term of the input Fourier series end plot(t, v1,'black') % plot the Fourier series grid xlabel('t, s') ylabel('f(t)') title('P15.3-4')

pi=3.14159; A=2; % input waveform parameters T=2; % period w0=2*pi/T; % fundamental frequency, rad/s tf=2*T; % final time dt=tf/200; % time increment t=0:dt:tf; % time, s a0=A/2; % avarage value of input v1=a0; % initialize input as vector for n=1:1:50 % for each term in the Fourier series ... an=0; % specify coefficients of the input series bn=-A/(pi*n); cn=sqrt(an*an + bn*bn); % convert to magnitude and angle form thetan=-atan2(bn,an); v1=v1+cn*cos(n*w0*t+thetan); % add the next term of the input Fourier series end plot(t, v1,'black') % plot the Fourier series grid

xlabel('t, s') ylabel('f(t)') title('P15.3-4')

pi=3.14159; A=2; % amplitud T=90; % periodo w0=2*pi/T; % frecuencia fundamental, rad/s tf=2*T; % tiempo final dt=tf/200; % incremento del tiempo t=0:dt:tf; % tiempo a0=1/pi; % valor de a0 v1=a0; % initialize input as vector for n=1:1:51 % for each term in the Fourier series ...

an=(2*cos(n*pi))/(pi-4*pi*n*n); % specify coefficients of the input series bn=(-4*n)/(pi-4*pi*n*n); cn=sqrt(an*an + bn*bn); % convert to magnitude and angle form thetan=-atan2(bn,an); v1=v1+cn*cos(n*w0*t+thetan); % add the next term of the input Fourier series end plot(t, v1,'black') % plot the Fourier series grid xlabel('t, s') ylabel('f(t)') title('P15.3-4')

FIG. Onda Cuadrada T=2pi 1.5

0.5

f(t)

-0.5

-1

-1.5

100

200

300

400 t, s

500

600

700

800

Das könnte Ihnen auch gefallen