feat: supply data for 2.2.b

This commit is contained in:
2025-10-21 23:52:42 -04:00
parent be25c4658c
commit f530b16356
2 changed files with 43 additions and 8 deletions

View File

@@ -122,18 +122,28 @@ This yields the following RMSE values in Table \ref{table:rmse1}.
This section was generated using the function
\texttt{run\_2\_2\_a\_conv\_pred()} as seen in the Source code section
below.
below, as of commit cad74a446ac2ebbde58e587b93dc2d2b53da3404.
\subsubsection{Lab3 section 2.2.b.}
This next section was more difficult. Because of the very coarse
measurement, synchronizing automatically eluded the techniques we had
on hand in Python, so calculating sums was very difficult. Had we
known this would be so difficult in software, a hardware approach
would have been taken to trigger at zero-crossings and ensure all
samples were recorded in a synchronous manner in the first place.
$x_1(t) + x_2(t)$, with $x_1(t) = A_1 \sin(\omega_1 t)$,
$x_2(t) = A_2 \sin(\omega_2 t)$, and $(f_1, f_2, A_1, A_2)$ with such
values as
$(\SI{50}{\hertz}, \SI{100}{\hertz}, \SI{1}{V}, \SI{0.5}{V})$ and
$(\SI{50}{\hertz}, \SI{100}{\hertz}, \SI{2}{V}, \SI{4}{V})$.
\begin{figure}[h]
\caption{A combination of sinusoids}
\label{img:2_2_b_combined}
\centering
\includegraphics[width=0.8\textwidth]{img/2_2_b_combined}
\end{figure}
The imagery in this section was created using the function
\texttt{run\_2\_2\_b\_show()} from the Source code section below.
\subsubsection{Lab3 section 2.2.c.}
Incomplete.
\section{Discussion of Measurements, experiments and/or simulations}
@@ -374,6 +384,7 @@ def load_scope_data(filename):
# 3. Read the data rows
timearr, v1arr, v2arr = [], [], []
trigger = False
last_last_v1 = 1
last_v1 = 1
for row in reader:
# Check if the row is not empty
@@ -384,9 +395,10 @@ def load_scope_data(filename):
v1 = float(row[2])
v2 = float(row[3])
if v1 > 0 and last_v1 < 0:
if v1 > 0.0 and last_v1 <= 0.0 and last_last_v1 <= 0.0:
trigger = True
print ("TRIGGERED")
last_last_v1 = last_v1
last_v1 = v1
if not(trigger):
continue
@@ -423,6 +435,29 @@ def run_2_2_a_conv_pred():
plot_single_sinusoid_freq(5)
plot_single_sinusoid_freq(10)
plot_single_sinusoid_freq(100)
def run_2_2_b_show():
plt.figure(num='Window')
plt.xlabel('t (s)')
plt.title(f'Sum of sinusoids')
plt.ylabel('V')
plt.grid(True)
t2, x2, y2 = load_scope_data('/home/hurricos/Sync/org/School/EE3150/LAB3/data/2_2_b/y1.csv')
plt.plot(t2, x2, label=r'v_in1')
plt.plot(t2, y2, label=r'v_c21')
t2, x2, y2 = load_scope_data('/home/hurricos/Sync/org/School/EE3150/LAB3/data/2_2_b/y2.csv')
plt.plot(t2, x2, label=r'v_in2')
plt.plot(t2, y2, label=r'v_c22')
t2, x2, y2 = load_scope_data('/home/hurricos/Sync/org/School/EE3150/LAB3/data/2_2_b/y1_y2_sum.csv')
plt.plot(t2, x2, label=r'v_in')
plt.plot(t2, y2, label=r'v_c2')
plt.legend()
plt.show()
run_2_2_b_show()
\end{minted}
\section{Summary and Conclusions}

BIN
img/2_2_b_combined.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB