Lab07

html

School

University of British Columbia *

*We aren’t endorsed by this school

Course

119

Subject

Electrical Engineering

Date

Apr 3, 2024

Type

html

Pages

6

Uploaded by MateDiscovery15175

Report
Lab 07 - RC Circuit I Edit this cell and provide the information requested: Your name: Tusharkant Pradhan Your student number: 80976202 Partner's name: Fernando Yoji Tabuchi In [2]: %reset -f import numpy as np import data_entry2 import matplotlib.pyplot as plt Part A - FAMILIARIZE, Part 1 - Overview of your resistor-capacitor (RC) circuit and the oscilloscope tutorial Materials: Similar circuit as of last time, addition of a capacitor set parallel to the resistor. Power supply, variable resistor, capacitor, oscilloscope resistor, capacitor and oscilloscope setup in parallel in their respective orders Capacitor (21) positive red wires connected till the last parallel setup i.e. the capacitor and the rest is negative Oscilloscope Scale vertical scale: channel 1, 200mV per centimeter of screen horizontal scale: 100 microseconds Controls: Trigger: edge, source > ch1, Couple > DC, Edge > Fall Level: 1.18V Part B - FAMILIARIZE, Part 2 - Make an initial set of measurements Before making any measurements, record the number on your capacitor in your lab notes. You will use this same setup next week and will be able to continue using your data from this week as long as you are certain you are using the same capacitor. In [12]:
de1 = data_entry2.sheet("prelab07_data") deltat = t2Vec - t1Vec # difference in time between points W = V1Vec / V2Vec # ratio of voltage lnW = np.log(W) # taking the logarithm - note that np.log(X) calculates ln(X) in Python tau = deltat / lnW # calculating the time constant print("tau =",tau, "s") C = tau/RVec print("C =", C) # Subproblem 1: propagation of u_deltaT u_deltat = np.sqrt( u_t1Vec**2 + u_t2Vec**2 ) # Subproblem 2: propagation of u_W # - Recall that W was defined in an earlier code cell u_W = W * np.sqrt( (u_V1Vec/V1Vec)**2 + (u_V2Vec/V2Vec)**2 ) # Subproblem 3: propagation of u_lnW u_lnW = u_W/W # correct this equation # subproblem 4: propagation of u_deltaT/lnW to get u_tau u_tau = tau* np.sqrt( ((u_deltat/deltat)**2) + ((u_lnW/lnW)**2) ) # correct this equation print("u_tau =",u_tau, "s") print("tau =",tau, "s") print("Relative uncertainty u_tau/tau = ",u_tau/tau) Sheet name: prelab07_data.csv tau = [0.00053391 0.00058274 0.00062966 0.00068902 0.0007469 ] s C = [1.06781314e-07 1.05951956e-07 1.04944159e-07 1.06002780e-07 1.06700479e-07] u_tau = [6.30900982e-06 1.74243223e-05 1.35156570e-05 1.74719300e-05 1.47396293e-05] s tau = [0.00053391 0.00058274 0.00062966 0.00068902 0.0007469 ] s Relative uncertainty u_tau/tau = [0.01181669 0.0299009 0.02146484 0.02535772 0.01973432] Part C - FAMILIARIZE, Part 3 - Develop your measurement strategy for further measurements In order to make the graph of R vs tau, we needed to experiment by changing the resistance values to different increments and we found that increments of 500 ohms was suitable. Controlling other variables is necessary in the sense of making a fair tau vs R graph Therefore, t1, v1 and y1 values were ccontrolled throughout the data collection while R was manipulated
The uncertainties of x values which is the independent variable follows a rectangular pdf while the uncertainties on the y values follow Gaussian pdf. In [ ]: Part D - MEASURE & ANALYZE - Collect additional data and create a scatter plot In [37]: # Scatter step 1: find the limits of the data: xmin = np.min(RVec) # use the np.min function to find the smallest x value xmax = np.max(RVec) # same for max # Scatter step 2: generate a bunch of x points between xmin and xmax xpoints = np.linspace(xmin, xmax, 200) # gives 200 evenly spaced points between xmin and xmax # Scatter step 3: calculate the model values: #calculating slop with the first and last data point: slope = 0.00000011 # Our initial estimate of the slope from above (units: N/m). intercept = -0.000027 P = 2 ypoints = xpoints*slope + intercept # this calculates the yvalues at all 200 points. # Scatter step 4: plot the curve. We plot this as a red line "r-" : plt.plot(xpoints, ypoints, "r-", label = " vs R") 𝜏 # Scatter step 5: plot the data: plt.errorbar(RVec, tau, u_tau, fmt="bo", markersize = 3, label="Experimental data") plt.title("Tau (s) vs Resistance (Ω)") plt.xlabel("Resistance (Ω)") plt.ylabel("Tau (s)") plt.legend() plt.show() # Residuals step 1: Calculate the model at each x-datapoint ymodel = slope * RVec + intercept # y = mx at each x_i # Residuals step 2: Calcualte the residual vector ResVec = tau - ymodel # Resoduals step 3: Plot the residual vector against the x-data vector plt.errorbar(RVec, ResVec, u_tau, fmt="bo", markersize = 3) # Residuals step 4: Add a R = 0 x-axis (horizontal line) to the plot plt.hlines(y=0, xmin=xmin, xmax=xmax, color='k') # draw axis at y = 0.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
# Residuals step 5: Add axis labels and title, and show the graph plt.title("Tau (s) vs Resistance (Ω)") plt.xlabel("Resistance (Ω)") plt.ylabel("Tau (s)") plt.show() chi2 = np.sum((ResVec/u_tau)**2)/(len(ResVec)-P) print("chi^2 = ", chi2)
chi^2 = 1.0655958911229442 Part E - COMPARE, SUMMARIZE, REFLECT Analysis of the graph: The regression line plotted aligns pretty well with the data points as almost all data points visually seem to overlap with the line except for the first one. The same is translated and clarified in the residuals graph as the first data point does not have its error overlapping the y=0 line. This means that the 68% confidene interval is pretty well preserved. The same can be confirmed with the CHI^2 value which turned out to be around 1.07. This means that the slope is a good fit. Capacitance: The capacitance is the slope since tau = RC, the slope/capacitance that fit the data points well was found to be around 1.1x10^-7 Farads. Which is pretty close to the theoretical value indicated in this lab (1x10-7F). Overall, the residual graph and the chi^2 values do help to decribe the goodness of the fit of the line as our result is also pretty "good". Improvement: -More data collection to especially in this case since we only used about 5 data points. More data points result
in a reliable source of analysis and discussion -A more accurrate hoizontal scale measurement in the oscilloscope since it can increase/decrease uncertainty on the Gaussian pdf of the y-values Submit Steps for submission: 1. Click: Run => Run_All_Cells 2. Read through the notebook to ensure all the cells executed correctly and without error. 3. File => Save_and_Export_Notebook_As->HTML 4. Upload the HTML document to the lab submission assignment on Canvas. In [ ]: display_sheets()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help