Browse Source

day 4

day-3
parent
commit
2a70301f61
4 changed files with 202 additions and 6 deletions
  1. +5
    -5
      3_equ-tab-figs/1_equations/main.tex
  2. +12
    -0
      4_pgfplots/data.csv
  3. +153
    -0
      4_pgfplots/main.tex
  4. +32
    -1
      webinar.org

+ 5
- 5
3_equ-tab-figs/1_equations/main.tex View File

@ -20,11 +20,11 @@ Here we can find a way to write long equations like \eqref{eq:fraction}:
\noindent here $t$ is time in seconds.
More complex equations can be written using symbols and commands from math-mode. An example is the Fourier coefficients equations \eqref{eq:a0},\eqref{eq:an} and \eqref{eq:bn}:
\begin{eqnarray}
a_0=\frac{1}{T}\int_0^T f(t)dt \label{eq:a0}\\
a_n=\frac{2}{T}\int_0^T f(t)\cdot \cos{\left(\frac{2\pi nt}{T}\right)}dt \label{eq:an}\\
b_n=\frac{2}{T}\int_0^T f(t)\cdot \sin{\left(\frac{2\pi nt}{T}\right)}dt \label{eq:bn}
\end{eqnarray}
\begin{align}
a_0&=\frac{1}{T}\int_0^T f(t)dt \label{eq:a0}\\
a_n&=\frac{2}{T}\int_0^T f(t)\cdot \cos{\left(\frac{2\pi nt}{T}\right)}dt \label{eq:an}\\
b_n&=\frac{2}{T}\int_0^T f(t)\cdot \sin{\left(\frac{2\pi nt}{T}\right)}dt \label{eq:bn}
\end{align}
Previous equations are used to define the Fourier series as:
\begin{equation}


+ 12
- 0
4_pgfplots/data.csv View File

@ -0,0 +1,12 @@
time, voltage, current
0, 1, 3
1, 1.3, 3.1
2, 1.1, 3.5
3, 1.01,3.8
4, 1.0, 3.6
5, 1.7, 4
6, 2.5, 6
7,3.3, 9
8, 3.8, 10
9, 3.9, 12
10, 4.5, 15

+ 153
- 0
4_pgfplots/main.tex View File

@ -0,0 +1,153 @@
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
%\usepackage{pgf-pie}
\pgfplotsset{colormap/jet,width=3.5in,compat=1.16}
\title{pgfplots}
\author{Gerardo Marx Chávez-Campos}
\date{February 2021}
\begin{document}
\maketitle
\section{\LaTeX{} as calculator}
This is an example to insert plots computed by \LaTeX{}:
\begin{figure}[!htb]
\centering
\begin{tikzpicture}
\begin{axis}
\addplot{3*x+5};
\addlegendentry{$f(x)$}
\addplot{x^2+5};
\addlegendentry{$g(x)$}
\end{axis}
\end{tikzpicture}
\caption{Caption}
\label{fig:my_label}
\end{figure}
\newpage
\section{Bar plots}
\begin{figure}[!htb]
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel=Groups,
ylabel= Counts,
symbolic x coords={Group1, Group2, Group3},
ybar,nodes near coords,
enlarge x limits = 0.15,
xtick=data
]
\addplot coordinates{
(Group1,3)
(Group2,4)
(Group3,2)
};
\addplot coordinates{
(Group1,2)
(Group2,4)
(Group3,1)
};
\legend{MacOs, Windows}
\end{axis}
\end{tikzpicture}
\caption{Caption}
\label{fig:my_label}
\end{figure}
%\section{Pie charts}
%\begin{figure}
% \centering
% \begin{tikzpicture}
%\pie{22.97/Los Angeles Lakers,
% 22.97/Boston Celtics,
% 8.11/Golden State Warriors,
% 8.11/Chicago Bulls,
% 6.76/San Antonio Spurs,
% 31.07/Other Teams}
%\end{tikzpicture}
% \caption{Caption}
% \label{fig:my_label}
%\end{figure}
\section{Reading data from CSV files}
\begin{tikzpicture}
\begin{semilogyaxis}[
legend pos=north west,
%ylabel style={rotate =-90},
xlabel=x,
ylabel=y]
\addplot[color=black, mark=*, line width=1pt] table[x=time, y=voltage, col sep=comma]{data.csv};
\addlegendentry{voltage}
\addplot table[x=time, y=current, col sep=comma]{data.csv};
\addlegendentry{current}
\end{semilogyaxis}
\end{tikzpicture}
\section{3D Plots}
\begin{figure}[!htb]
\centering
\begin{tikzpicture}
\begin{axis}
\addplot3[
mesh,
samples=50,
domain=-10:9
]
{sin(deg(sqrt(x^2+y^2)))/sqrt(x^2+y^2)};
\addlegendentry{$f(x)$}
\end{axis}
\end{tikzpicture}
\caption{The Mexican hat}
\label{fig:my_label}
\end{figure}
\section{How to configure PGFPlots}
\begin{figure}[!h]
\centering
% \includegraphics{}
\begin{tikzpicture}
\begin{axis}[
xlabel=time $t$,
mark size =2.5pt,
ylabel= $f(t)$
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]
\addplot[
dashed,
domain=-3:3,
samples=20,
mark=*,
color=black,
line width=1pt,
]
{x^2+9};
\addlegendentry{Eq1}
\addplot[
dotted,
mark options={solid},
domain=-3:3,
samples=20,
mark=o,
line width=1pt,
color=black!40!white]
{20*sin(2*x*20)};
\addlegendentry{$\sin(40x)$}
\end{axis}
\end{tikzpicture}
\caption{Caption}
\label{fig:my_label}
\end{figure}
\end{document}

+ 32
- 1
webinar.org View File

@ -3,7 +3,38 @@
* First day
** Hello world
** Fonts and styles
** Geometry and space
** DONE Geometry and space
- The total allowable width of the text area is 6.5 inches wide by 8.75 inches high. The top margin on each page should be 1.2 inches from the top edge of the page. The left margin should be 0.9 inch from the left edge. The footer with page number should be at the bottom of the text area.
-
* DONE Second day
* TODO Third day: Equations, Figures and Tables [78%]
:LOGBOOK:
:END:
- [X] The basic document
- [X] The thesis structure (file organization):(https://www.overleaf.com/read/mbsctvpssghf)
- [X] Inline equations
- [X] Enumerated equations and no enumerated equations
- [X] Three equations *eqnarray*
- [X] _Fourier challenge_
- [ ] Matrices
- [X] Figures
- [X] Upload a figure
- [X] Subfigures
- [X] Cross-references
- [ ] my own command
- [X] Tables (booktabs)
- [ ] Subtables
* TODO Fourth day: PGFPlots and other things[0%]
- [ ] Matrices
- [ ] My own command example
- [ ] Plotting an equation
- [ ] Scatter plots
- [ ] Pie plots
- [ ] Bar plots
- [ ] Setting label, markers and colors
- [ ] Creating a data file (CSV)
- [ ] Plotting data from a CSV file
- [ ] How to install LaTeX
- [ ] GNUPlots

Loading…
Cancel
Save