You are on page 1of 9

Electronics

08/03/2022

Practice 4, true RMS value in Matlab.


César Gonzales Pozada, César Alejandro Cabrera Cuéllar, Eric Samuel Quiroz Gonzales,
Adair Téllez Aviles

 Breadboard: It is a test board in which electronic elements


Abstract— Here we are going to work with Matlab to obtain the and cables can be inserted with which circuits are assembled
value of the voltage RMS and the figure of each graph solved in without the need to solder any of the components.
the previous practice. Breadboards have holes connected to each other by small
metal sheets. [3]
Index Terms—Voltage transformer, Oscilloscope, Peak
Voltage , Electronics, Matlab. Voltage transformer: A voltage transformer is an electrical
element that allows the voltage to be increased or decreased in
an alternating current electrical circuit.
I. INTRODUCTION These types of devices can reduce or increase the voltage that
enters a home or business in addition to allowing the
n this practice we are going to simulate the exercises of the distribution of energy to the different points that make up a
I previous practice with help of the software “Matlab”, we
need to obtain the graph of each exercise and the value of
network. [4]

the voltage RMS to show that the calculous and the simulation Matlab: MATLAB (short for MATrix LABoratory, "matrix
was correct. laboratory") is a numerical computation system that offers an
integrated development environment (IDE) with its own
II. THEORETICAL BACKGROUND programming language (M language). It is available for Unix,
Windows, macOS, and GNU/Linux platforms. [5]
Oscilloscope: An oscilloscope is a measuring instrument for
electronics. Plot a graph of amplitude on the vertical axis and
time on the horizontal axis. It is widely used by students, III. MATERIALS
designers, engineers in the field of electronics. It is often  Oscilloscope
complemented by a multimeter, a power supply, and an  Protoboard
arbitrary or function generator. [1]  24V/5A transformer
 Oscilloscope probe
Electronics: Electronics can be defined as the study and
application of the behavior of electrons in various scenarios. IV. METHODOLOGY
These can be the vacuum, gases and semiconductors subjected
to the action of electric and magnetic fields. [2] Exercise 1: "Find the RMS value of the equation".
For Exercise 1, we were presented with the following
Electrical signals: Electrical signals are also called analog equation;
signals. They can have any reading within the range and are 𝑉(𝑡) = 180 sin(𝜃) 𝑓𝑜𝑟 0 < 𝜃 ≤ 2𝜋
only limited by the characteristics of the recording and
indicating instruments. They continuously transmit the values Where the naked eye can see that it is the equation of a
to the controller. [2] sinusoidal signal.
For this occasion, a code was made in the matlab software, to
Oscilloscope probe: It is a device that allows a physical check our results from the previous practice, in addition to
connection between a signal source or test point (DUT) and an graphing the same function, and even marking the RMS
electronic measurement instrument, such as an oscilloscope. voltage.
[3] For this, the variables begin to be declared and the meaning of
each of them is shown below.
In Figure 1.1 you can see T, which would be the period, in this
part it is remembered that the devices refresh their value 5

1
Electronics
08/03/2022
times/s, according to the IEEE, therefore each refresh lasts 0.2 Exercise 2: "Find the RMS value of the equation".
s.
On the other hand, there is Fs, which is the recommended For this problem we have the equation 20 sin(𝜃) + 5, which
frequency in instrumentation (1200/0.2=240). belongs to a sinusoidal signal, this equation also has an offset
Finally it have t, which is the time, for your understanding: (vertical displacement).
"start: interval: end"
𝑉(𝑡) = 20 sin(𝜃) + 5 𝑓𝑜𝑟 0 < 𝜃 ≤ 2𝜋

Subsequently, the Matlab software is used to arrive at the


value of the Vrms of said function.
For this, the variables begin to be declared and the meaning of
Figure 2.1 “Code for the graph” each of them is shown below.
Later we have the function, which is stored in the variable "v", In Figure 2.1 you can see T, which would be the period, in this
it can be seen that it is multiplied by 180 (Figure 1.2). part it is remembered that the devices refresh their value 5
times/s, according to the IEEE, therefore each refresh lasts 0.2
s.
On the other hand, there is Fs, which is the recommended
Figure 1.2 “Code for the graph” frequency in instrumentation (1200/0.2=240).
Finally it have t, which is the time, for your understanding:
Then proceed to graphing. But in the same way the Vrms is "start: interval: end"
added, for this the length function is used that allows knowing
how many values are in V (Figure 1.3)

Figure 1.3 “Code for the graph” Figure 2.1 “Code for the graph”

The general formula for Vrms can then be entered, which is


known to be: Later we have the function, which will be stored in the
𝑉𝑝 variable "V", it can be seen that it is multiplied by 20 and also,
𝑉𝑟𝑚𝑠 = followed by the argument, the +5 of the offset is inserted
√2 (Figure 2.2).
Although in Matlab an equivalence was introduced (Figure
1.4)

Figure 2.2 “Code for the graph”

Figure 1.4 “Code for the graph”


Then proceed to graphing. But in the same way the Vrms is
added, for this the length function is used that allows knowing
Finally, the necessary lines are introduced so that the Vrms is how many values are in V (Figure 2.3)
added to the graph in addition to activating the grid (Figure
1.5).

Figure 2.3 “Code for the graph”

Figure 2.5 “Code for the graph” The general formula for Vrms can then be entered, which is
known to be:

2
Electronics
08/03/2022
𝑉𝑝 previously the 0.2 s were handled, if this value is left only a
𝑉𝑟𝑚𝑠 = fraction of a first period is seen, fs is frequency of sampling
√2
Although in Matlab an equivalence was introduced (Figure and with more values it becomes more vertical and finally t is
2.4) the time vector (Figure 3.1)

Figure 2.4 “Code for the graph”

Finally, the necessary lines are introduced so that the Vrms is


added to the graph in addition to activating the grid (Figure
2.5).

Figure 3.1 “Code for the graph”

Subsequently, the signal function is generated, which can be


seen to be equal to the sinusoidal one, but with the difference
that "square" is used and not "sin" to operate the argument
Figure 2.5 “Code for the graph”
(Figure 3.2).
Exercise 3: "Saw graph to find the RMS value of the
graphed voltage".
Figure 3.2 “Code for the graph”
For exercise 3 we have a square wave, which, unlike the
sinusoidal signal, does not go through intermediate values.
The Vrms of this wave should be found (Figure 3.1).
Then proceed to graphing. But in the same way the Vrms is
added, for this the length function is used that allows knowing
how many values are in V (Figure 3.3)

Figure 3.1 "Study graph for exercise 3".


It can be seen that the square wave is different from a Figure 3.3 “Code for the graph”
sinusoidal signal. The way to solve this problem will be with
your Vpeak and with your period. It can see that it goes from 0 Again the general formula for Vrms can then be entered,
to 𝜋 in 2 and from 𝜋 to 2𝜋 in -2. which is known to be:
𝑉𝑝
Then: 𝑉𝑟𝑚𝑠 =
√2
2→ 0<𝑡≤𝜋 Although in Matlab an equivalence was introduced (as can be
𝑉(𝑡) = {
−2 → 𝜋 < 𝑡 ≤ 2𝜋 seen in Figure 3.3)

Because the problem is going to be solved by the Matlab Finally, the necessary lines are introduced so that the Vrms is
software, the code that begins with the variables must be added to the graph in addition to activating the grid (Figure
developed again. 3.4).
Where 2pi does not represent angle, it represents a value
(period of the signal), f the frequency, in the case of T
3
Electronics
08/03/2022

Figure 4.2 "First Algorithm Fragment for Exercise 4".


Continuing with the algorithm, the variable "T" is entered,
Figure 3.4 “Code for the graph” which corresponds to the graphing time, which is standardized
in a value of 0.2s; continuing with the variable "Fs" where
you have a frequency of 20 which is multiplied by the peak
Exercise 4: "Saw graph in Matlab with RMS value of value of the voltage signal which in this case is 5; a time
voltage". vector was entered to indicate the graphing interval, based on
For exercise number 4, the professor of the subject proposed a the variable "Fs" and a period of to replicate the graph in
voltage whose graph is of type "saw", the work in the previous Figure 4.1, although it could be without affecting the
practice was to find the RMS voltage value of the graph by simulation result. To enter the function the command
arithmetic calculations, now the work to be done is to graph "sawtooth" was used, which generates a graph of type saw,
the RMS voltage in the mathematical processing software for the specific case of the graph, the value of the function
MATLAB; the graph can be seen in Figure 4.1. "sawtooth" was multiplied by 5 and it was ordered to graph
with respect to the value of the time vector "t".. To finish
with the second fragment of the algorithm, a window with a
graph was configured through the "plot" command and a
graph of the variable "t" was specified with respect to
the "V" function, in addition to adding labels to the axes of
the plane, as well as the configuration in the graphing lines.
The lines of code are as follows (see Fig. 4.3.):

Figure 4.1 "Study graph for exercise 4".


To be able to graph the RMS voltage, the function that
governs the voltage signal is needed, since it is not a
sinusoidal or alternating current signal, the voltage function
and the true RMS value, were worked on in a previous
practice, and the results were as follows:

 𝑇 = [0,2𝜋] Figure 4.3 "Second Algorithm Fragment for Exercise 4".


𝟓
 𝒗(𝒕) = 𝒕−𝟓
𝝅 To finish with the algorithm, a line was programmed that
 𝑣𝑅𝑀𝑆 = 2.8868 𝑉 indicates the RMS value of the voltage, for this first the length
of the vector generated by the variable of the function
Once you have the v(t) function needed to find the actual RMS
named "V" was obtained. Remembering that to know the
voltage, and the RMS value as a reference, you have
value of Figure 4.3 "Second Algorithm Fragment for Exercise
completed the data necessary to be able to start with the
4".
programming code in Matlab.
To finish with the algorithm, a line was programmed that
To start with the programming algorithm, a new script is indicates the RMS value of the voltage, for this first the length
started in the Matlab interface and a few header lines are put of the vector generated by the variable of the function
to ensure that when the program created in the new script is named "V" was obtained. Remembering that to know the
run, console data, variables, information in the "command value of "𝑽𝑻𝒓𝒖𝒆𝑹𝑴𝑺 " the following equation is used:
window" or even pop-ups are deleted, the lines of code are as the following equation is used:
follows:

4
Electronics
08/03/2022

1 𝑡
𝑣𝑅𝑀𝑆 = √ ∫ 𝑣(𝑡)2 𝑑𝑡 𝒆. 𝒄 (𝟐)
𝑡 0

Knowing the equation was assigned in a variable "V2" the


value of raising the voltage function squared, then the whole
equation was achieved thanks to the
commands "sqrt" and "sum", and finally the value
of "Vrms" is multiplied with a vector that goes from 1 to the Figure 5.3 “Code for the graph”
value of "N", the graph of the value of "Vrms" is added to
the graph previously generated with its respective format From figure 5.1 we know that our period is 2π so we store it in
configuration. a variable named “periodo” in line 5 of the figure 5.3, then we
1
know that by formula the frequency is equal to so we
The lines of code are as follows (see Fig. 4.4.): 𝑝𝑒𝑟𝑖𝑜𝑑𝑜
store it in a variable as we can see in line 6.
In line 8 we stablish the graphing time that is equal to 10 times
the period this because if we put 0.2 seconds, that is the
refresh time of the electronic equipment, we can only saw a
fraction of a period because here a period have 2π seconds.
In line 9 we have the sample rate that must be at least 20 times
the frequency so we can obtain a more exactly graph.
Figure 4.4 "Third Algorithm Fragment for Exercise 4".
Exercise 5: "saw graph to find the RMS value of the In line 10 we have the vector of time that allow us to plot the
graphed voltage". graph in function of the time.
In exercise 5, the professor gives us a graph of a voltage signal
(figure 5.1) where we can see the value of the peak voltage but
we want to know which value would the voltage RMS would
be.

Figure 5.4 “Code for the graph”


In figure 5.4 we can see the use of the function “sawtooth”
that generates a sawtooth wave with period 2π for the
elements of the time array, we know that the amplitude of the
wave is −8 → 8 so we indicate this by multiply the function
by 8, as the argument of the function we have 2 ∗ 𝑝𝑖 ∗ 𝑓 ∗ 𝑡
Figure 5.1 "Study graph for exercise 5". because this function works similar as the “sin” function, we
can see that we include “0.5” this is because we need a
Now with help of the software “Matlab” we are going toplot triangular wave so we indicate that the peak point of the
this graph and the value of it voltage RMS. period is going to be in the half of the values.

Figure 5.2 “Code for the graph”


In figure 5.2 we have the tree first lines of code that help us to
clear the screen, then to clear the memory and then to close
everything.

5
Electronics
08/03/2022
Figure 5.5 “Code for the graph”
Exercise 2: "Find the RMS value of the equation".
Now we need to obtain the value of the voltage RMS of the
wave so we use the lines 14, 15 and 16 of the figure 5.5. First When running the program, the generated sine wave can be
we need a vector that have the same length of “x” that in this seen (Figure 2.6).
case is the sawtooth function, then we calculate the value of
1
the voltage RMS in line 15 by the formula √ ∑𝑖𝑛=0 𝑣(𝑛)2
𝑁
then we create the vector that contain the values of the RMS
voltage in line 16.
Finally we only need to plot the graph and the values of the
voltage RMS, so we use the lines 18 to 21.

V. EXPERIMENTATION AND RESULTS


Exercise 1: "Find the RMS value of the equation".
When running the program, the generated sine wave can be
seen (Figure 1.6).

Figure 2.6 “graph result”.

It can be seen that the duration time is 0.2 s, in addition to


having an offset, this graph does not start at 0, it starts at +5,
as it should be. Finally you can see the Vrms line as well as
the grid that was activated.
In addition, as mentioned at the beginning, due to its duration,
in the Figure 12 periods can be seen.

Exercise 3: "Saw graph to find the RMS value of the


graphed voltage".
When running the program you can see the graph, it contains 2
Figure 2.6 “graph result”. periods in addition to the fact that its Vrms is in the same
place as its Vpeak, a characteristic that can indicate that the
It can be seen that the duration time is 0.2 s, and the RMS is generated code is correct.
127.3
In addition, as mentioned at the beginning, due to its duration, It can be seen that it goes from 2 to 2 and finally that said
in the Figure 12 periods can be seen. signal does start at 0 (Figure 3.5).

6
Electronics
08/03/2022

𝑽𝑻𝒓𝒖𝒆𝑹𝑴𝑺

Figure 4.6 "GRAPH of RMS voltage signal in saw, exercise


4".

Exercise 5: "saw graph to find the RMS value of the


Figure 3.5 “graph result”. graphed voltage".
Here we are going to show how do the graph results.
Exercise 4: "Saw graph in Matlab with RMS value of
voltage".
Once the programming corresponding to the algorithm in
Matlab is finished, we proceed to verify that the results are
correct in the graph made by the mathematical processing
program, in Figure 4.5 the graphic result of the program
performed is

Figure 5.6 “graph result”.

As we can see in figure 5.6 we graph 10 periods but we can


graph only one or 100 if we want, we can do this by
modifying the line 8 in figure 5.3.

Figure 4.5 "Graph of voltage signal in saw, exercise 4".

To check the RMS voltage value calculated in a previous


laboratory practice, a "data cursor" marker is added, the result
was as follows:

Figure 5.7 “graph result”

7
Electronics
08/03/2022
In figure 5.7 we can see the results of the graph showing only Thanks to the handling of specific functions in Matlab, it was
two periods, we can see that one period goes from 0 → 2𝜋 and possible for the collaborative team to replicate the graph in
it peak value was in π, we also can see the value of the voltage Figure 4.1, as well as to correctly perform the graph with the
RMS that matches with the value obtained in the previous real RMS value of the sawtooth graph of exercise
practice. 4. Remaining, as a result of practice, the source code made in
Matlab to carry out the graphing of the actual RMS value of
VI. DISCUSSION OF RESULTS the energy line presented in the saw graph (see Figure 1), and
Exercise 2: "Find the RMS value of the equation". ensures that it can be used for any graph that corresponds to
the type "sawtooth".
What is obtained with Matlab is equal to what is obtained by
analytically developing this sinusoidal signal and the Vrms Exercise 5: "saw graph to find the RMS value of the
coincides, therefore the developed code is correct. graphed voltage".

On the other hand, in Figure 2.7 you can see a variant in case With help of the software Matlab we can prove that the results
you want to see the area under the curve. obtained in the previous practice are correct and we can learn
how to plot the graph of the exercise and learn some news
functions in Matlab .

VII. CONCLUSIONS
A. General conclusion

Matlab is a multidynamic software for applied mathematics or


as described in its own domain "It is a product that millions of
engineers and scientists around the world use to analyze and
design the systems and products that transform our world" [5].
For the purposes of the requested work Matlab was used as a
grapher of the calculations previously performed, with the
help of some commands such as "sawtooth", "awgn",
"square", "ones", "sum", "plot", etc. And in the end it was
possible to verify that the previously extracted calculations are
correct.
The RMS voltage is a data that is of vital importance when
Figure 2.7 “graph result”. you are working with electronic circuits, since the RMS value
allows you to specify a wave or wave signal as a CD current,
since it is the equivalent CD voltage that delivers the same
Exercise 3: "Saw graph to find the RMS value of the amount of energy to a load in a circuit as the AC signal does
graphed voltage". over its cycle. [6]
For this graph there were differences when generating the
B. Individual conclusion
code since here it is easier to vary the number of periods. On
the other hand, the square function is used, which does not
César Alejandro Cabrera Cuéllar
have any difficulty since it is similar to using the sine
function.
This practice initially allows you to make a comparison or
Finally, the same result was reached in software as the one verify the results obtained analytically and thus make the most
obtained analytically. accurate calculations.
On the other hand, it allows a better interpretation of the
results in addition to taking advantage of various benefits that
Exercise 4 “Saw graph to find the RMS value of the Matlab has for cases that are closer to reality.
graphed voltage".

8
Electronics
08/03/2022
Adair Téllez Aviles [3] Anónimo. (2022). señales electricas. 11-02-2022, de StuDocu Sitio web:
https://www.studocu.com/cl/document/universidad-tecnologica-de-
It was possible to notice that the results obtained by means of chile/proyecto-electrico/01-senales-electricas-y-formas-de-
the software are very similar to those obtained in an analytical ondas/6323980
way previously carried out in the previous practice, in this way [4] et al. (2019). ¿Qué es un transformador eléctrico y cómo funciona?.
we could notice that we have carried out the calculations in the febrero 11, 2021, de tecsa Sitio web:
https://www.tecsaqro.com.mx/blog/que-es-un-transformador-electrico/
appropriate way.
[5] The MathWorks, Inc.. (2020). MATLAB Product Description.
Eric Samuel Quiroz González 24/10/2020, de The MathWorks, Inc. Sitio web:
https://la.mathworks.com/help/matlab/learn_matlab/product-description.html
Simulating the wave of the excessive and the value of the [6] Anónimo. (2015). ¿Qué es el Voltaje RMS?. 04/03/2022, de Aprender
voltage RMs it’s a great way to prove our results and to sobre electrónica. Sitio web:
increase our capabilities to use the software because it is a http://www.learningaboutelectronics.com/Articulos/Voltaje-RMS.php
software that allows us many things and let us to work more
efficiently and quickly.

Cesar Gonzalez Pozada.

At the end of the practice I feel satisfied to have been able to


graph in Matlab the real RMS voltage value, which could be
supplied by some electronic device, which in the case of
exercise 4 (which I perform) was a non-sinusoidal energy
signal and therefore the known clearance of peak voltage
between the root of 2 could not be applied, then by means of
the "sawtooth" function the actual RMS voltage could be
plotted as a signal with a saw graph.

C: Individual contribution

César Alejandro Cabrera Cuéllar

For this practice I developed the program for exercises 2 and 3


as well as the methodology, experimentation and discussion of
their results.
Adair Téllez Aviles

For this practice I made the development of the exercise 1.

Eric Samuel Quiroz González

For this practice I made the development of the exercise 5.

Cesar Gonzalez Pozada.


For this practice I wrote the methodology, experimentation
and discussion of the results of exercise 4, in addition to the
general conclusion.

REFERENCES
[1] Final Test S.A. de C.V.. (2022). ¿Que es un osciloscopio?. 11-02-2022, de
FiNAL TEST Sitio web: https://www.finaltest.com.mx/product-p/art-
9.htm
[2] Anónimo. (2022). Qué es la electrónica y cuál es su importancia. 11-02-
2022, de Aprende INSTITUDE Sitio web:
https://aprende.com/blog/oficios/reparacion-electronica/que-es-la-
electronica/

You might also like