Matlab Support

The following solution depicts the standard of the Matlab support provided by us to the students.  Matlab code is written to stimulate the problem and to find the Fourier series of the output signal. The expansion of periodic functions using a series of trigonometric functions is used in Fourier analysis as given in our. We have plotted the input signal, Fourier series harmonics and output signal, then identified the number of harmonics to get the actual output signal. Mathematical representation is also displayed for the Fourier series harmonics as presented in.  Built-in functions are used to minimize the code and obtain the results. Analysis is done and data is presented in numeric form.

Fourier series are named after Jean-Baptiste Joseph Fourier, although he was only one of many contributors to the subject. Using basic calculus, the method provides a straightforward way to decompose any periodical signal harmonic fourier series into a sum of scaled and shifted Matlab support trigonometric functions. These basis functions are chosen for their favorable mathematical properties (periodicity, differentiability) and their inherent usefulness in the area of electrical engineering where they simplify the analysis of alternating current circuits.

clear variables
close all
clc
%% Q1 - half wave rectification
n=10;
s=1/pi;
time=-4*pi:0.01:4*pi;
%Simulated version
syms t p
s_sym=1/p;
for k=1:n
if k==1
s=s+0.5*sin(k*time);
s_sym=s_sym+0.5*sin(k*t);
elseif mod(k,2)==0
a=2/(pi*(1-k^2));
s=s+a*cos(k*time);
s_sym=s_sym+2/(p*(1-k^2))*cos(k*t);
end

Harmonic Fourier Series

The method itself is a projection on the basis using standard inner product. The standard trigonometrically form interpolate Matlab has three individual terms – the direct or zero harmonic that represent the mean value of the signal on one period, the odd sum of sine terms and an even sum of cosine terms. This structure simplifies the analysis of even and odd signal as it eliminates Matlab support, one of the groups of addends.

It was already mentioned that differentiability is an important property of Fourier series. Since differentiation and integration are liner transformations as well as Fourier series, a function can be replaced by the Fourier series approximation for numerical solving [1]. Because they are differentiable infinite number of times, they can be used in solving any Matlab support degree of differential equations and to desired precision by taking an arbitrary number of Fourier series terms. The problem with this method is that the function doesn’t handle discontinuities standard deviation Matlab well which is further discussed in the appropriate reference.

plot(time,sin(time),time,s)
xlabel('Time(s)')
ylabel('Amplitude')
title('Half-wave rectifier')
legend('Input','Output')
disp('Analytic formula of the series')
disp(s_sym)
%% Q1 - Full wave rectification
n=20;
s=2/pi;
time=-4*pi:0.01:4*pi;
%Simulated version
syms t p
s_sym=2/p;
for k=1:n
a=4/(pi*(1-4*k^2));
s=s+a*cos(2*k*time);
s_sym=s_sym+4/(p*(1-4*k^2))*cos(2*k*t);
end

Analysis

The problems will be solved analytically and then visualized numerically. simrf The code has the following flowchart:

01

For the half way rectifier we find the Fourier series of the output signal with period :

plot(time,sin(time),time,s)
xlabel('Time(s)')
ylabel('Amplitude')
title('Full-wave rectifier')
legend('Input','Output')
disp('Analytic formula of the series')
disp(s_sym)

Notice that for n=1 the coefficient is 0, and all the coefficients in b are 0 except . Also, the zero harmonic is easily Matlab support calculated by substituting n=0,  The output is:

The solution in the symbolic form as outputted by MATLAB and the corresponding plot are shown below:

Analytic formula of the series

sin(t)/2 – (2*cos(2*t))/(3*p) – (2*cos(4*t))/(15*p) – (2*cos(6*t))/(35*p) – (2*cos(8*t))/(63*p) – (2*cos(10*t))/(99*p) + 1/p

02

%% Q2 - Rectangular wave
n=20;
s=0;
time=-4*pi:0.01:4*pi;
%Simulated version
syms t p
s_sym=0;
for k=1:2:5
b=4/(pi*k);
s=s+b*sin(k*time);
s_sym=s_sym+4/(p*k)*sin(k*t);
end

For the full wave rectifier we keep the similar formulation but reduce the period to :

plot(time,s)
xlabel('Time(s)')
ylabel('Amplitude')
title('Rectangular input')
disp('Analytic formula of the series')
disp(s_sym)
%Output with transfer function
sout=0;
R=1;%Ohm
C=1;%F
T=2*pi;
w0=2*pi/T;
for k=1:2:5
w=k*w0;
H=1/(1+1j*R*C*w);
b=4/(pi*k);
sout=sout+abs(H)*b*sin(k*time+angle(H));
end

Due to around the y-axis (even signal) Matlab support symmetry, b-coefficients are zero.

Analytic formula of the series

2/p – (4*cos(4*t))/(15*p) – (4*cos(6*t))/(35*p) – (4*cos(8*t))/(63*p) – (4*cos(10*t))/(99*p) – (4*cos(12*t))/(143*p) – (4*cos(14*t))/(195*p) – (4*cos(16*t))/(255*p) – (4*cos(18*t))/(323*p) – (4*cos(20*t))/(399*p) – (4*cos(22*t))/(483*p) – (4*cos(24*t))/(575*p) – (4*cos(26*t))/(675*p) – (4*cos(28*t))/(783*p) – (4*cos(30*t))/(899*p) – (4*cos(32*t))/(1023*p) – (4*cos(34*t))/(1155*p) – (4*cos(36*t))/(1295*p) – (4*cos(38*t))/(1443*p) – (4*cos(40*t))/(1599*p) – (4*cos(2*t))/(3*p)

27

Finally, we find the Fourier transform for the square wave for A=1 and w=1:

Showing the reconstructed signal using only first 3 harmonics:

Analytic formula of the series

(4*sin(t))/p + (4*sin(3*t))/(3*p) + (4*sin(5*t))/(5*p)

28

The transfer function of the circuit is given by:

Each individual harmonic is transmitted as  where . The resulting feedback Matlab wave form is shown below:

29

03

figure

plot(time,s,time,sout)
xlabel('Time(s)')
ylabel('Amplitude')
title('Rectangular input and output')
legend('Input','Output')

It can be seen from the first two examples that a continuous function can be represented with a relatively small number of individual harmonics to obtain a smooth approximation. Decomposition into harmonics is shown to simplify circuit analysis Matlab support and also provide an alternate method for solving the differential equation that could be posted  on the circuit in question. Such methods are basis for general solving of second order differential equations.

Codes

clearvariables
closeall
clc
%% Q1 - half wave rectification
n=10;
s=1/pi;
time=-4*pi:0.01:4*pi;
%Simulated version
symstp
s_sym=1/p;
for k=1:n
if k==1
s=s+0.5*sin(k*time);
s_sym=s_sym+0.5*sin(k*t);
elseif mod(k,2)==0
a=2/(pi*(1-k^2));
s=s+a*cos(k*time);
s_sym=s_sym+2/(p*(1-k^2))*cos(k*t);
end
plot(time,sin(time),time,s)
xlabel('Time(s)')
ylabel('Amplitude')
title('Half-wave rectifier')
legend('Input','Output')
disp('Analytic formula of the series')
disp(s_sym)
%% Q1 - Full wave rectification
n=20;
s=2/pi;
time=-4*pi:0.01:4*pi;
%Simulated version
symstp
s_sym=2/p;
for k=1:n
a=4/(pi*(1-4*k^2));
s=s+a*cos(2*k*time);
s_sym=s_sym+4/(p*(1-4*k^2))*cos(2*k*t);
end
plot(time,sin(time),time,s)
xlabel('Time(s)')
ylabel('Amplitude')
title('Full-wave rectifier')
legend('Input','Output')
disp('Analytic formula of the series')
disp(s_sym)
%% Q2 - Rectangular wave
n=20;
s=0;
time=-4*pi:0.01:4*pi;
%Simulated version
symstp
s_sym=0;
for k=1:2:5
b=4/(pi*k);
s=s+b*sin(k*time);
s_sym=s_sym+4/(p*k)*sin(k*t);
end
plot(time,s)
xlabel('Time(s)')
ylabel('Amplitude')
title('Rectangular input')
disp('Analytic formula of the series')
disp(s_sym)
%Output with transfer function
sout=0;
R=1;%Ohm
C=1;%F
T=2*pi;
w0=2*pi/T;
for k=1:2:5
w=k*w0;
H=1/(1+1j*R*C*w);
b=4/(pi*k);
sout=sout+abs(H)*b*sin(k*time+angle(H));
end
plot(time,s,time,sout)
xlabel('Time(s)')
ylabel('Amplitude')
title('Rectangular input and output')
legend('Input','Output')

 

Save