Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ME3263_Lab-02/notebook.tex
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
954 lines (772 sloc)
51.6 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Default to the notebook output style | |
% Inherit from the specified cell style. | |
\documentclass[11pt]{article} | |
\usepackage[T1]{fontenc} | |
% Nicer default font (+ math font) than Computer Modern for most use cases | |
\usepackage{mathpazo} | |
% Basic figure setup, for now with no caption control since it's done | |
% automatically by Pandoc (which extracts ![](path) syntax from Markdown). | |
\usepackage{graphicx} | |
% We will generate all images so they have a width \maxwidth. This means | |
% that they will get their normal width if they fit onto the page, but | |
% are scaled down if they would overflow the margins. | |
\makeatletter | |
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth | |
\else\Gin@nat@width\fi} | |
\makeatother | |
\let\Oldincludegraphics\includegraphics | |
% Set max figure width to be 80% of text width, for now hardcoded. | |
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}} | |
% Ensure that by default, figures have no caption (until we provide a | |
% proper Figure object with a Caption API and a way to capture that | |
% in the conversion process - todo). | |
\usepackage{caption} | |
\DeclareCaptionLabelFormat{nolabel}{} | |
\captionsetup{labelformat=nolabel} | |
\usepackage{adjustbox} % Used to constrain images to a maximum size | |
\usepackage{xcolor} % Allow colors to be defined | |
\usepackage{enumerate} % Needed for markdown enumerations to work | |
\usepackage{geometry} % Used to adjust the document margins | |
\usepackage{amsmath} % Equations | |
\usepackage{amssymb} % Equations | |
\usepackage{textcomp} % defines textquotesingle | |
% Hack from http://tex.stackexchange.com/a/47451/13684: | |
\AtBeginDocument{% | |
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code | |
} | |
\usepackage{upquote} % Upright quotes for verbatim code | |
\usepackage{eurosym} % defines \euro | |
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support | |
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document | |
\usepackage{fancyvrb} % verbatim replacement that allows latex | |
\usepackage{grffile} % extends the file name processing of package graphics | |
% to support a larger range | |
% The hyperref package gives us a pdf with properly built | |
% internal navigation ('pdf bookmarks' for the table of contents, | |
% internal cross-reference links, web links for URLs, etc.) | |
\usepackage{hyperref} | |
\usepackage{longtable} % longtable support required by pandoc >1.10 | |
\usepackage{booktabs} % table support for pandoc > 1.12.2 | |
\usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment) | |
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout) | |
% normalem makes italics be italics, not underlines | |
% Colors for the hyperref package | |
\definecolor{urlcolor}{rgb}{0,.145,.698} | |
\definecolor{linkcolor}{rgb}{.71,0.21,0.01} | |
\definecolor{citecolor}{rgb}{.12,.54,.11} | |
% ANSI colors | |
\definecolor{ansi-black}{HTML}{3E424D} | |
\definecolor{ansi-black-intense}{HTML}{282C36} | |
\definecolor{ansi-red}{HTML}{E75C58} | |
\definecolor{ansi-red-intense}{HTML}{B22B31} | |
\definecolor{ansi-green}{HTML}{00A250} | |
\definecolor{ansi-green-intense}{HTML}{007427} | |
\definecolor{ansi-yellow}{HTML}{DDB62B} | |
\definecolor{ansi-yellow-intense}{HTML}{B27D12} | |
\definecolor{ansi-blue}{HTML}{208FFB} | |
\definecolor{ansi-blue-intense}{HTML}{0065CA} | |
\definecolor{ansi-magenta}{HTML}{D160C4} | |
\definecolor{ansi-magenta-intense}{HTML}{A03196} | |
\definecolor{ansi-cyan}{HTML}{60C6C8} | |
\definecolor{ansi-cyan-intense}{HTML}{258F8F} | |
\definecolor{ansi-white}{HTML}{C5C1B4} | |
\definecolor{ansi-white-intense}{HTML}{A1A6B2} | |
% commands and environments needed by pandoc snippets | |
% extracted from the output of `pandoc -s` | |
\providecommand{\tightlist}{% | |
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} | |
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} | |
% Add ',fontsize=\small' for more characters per line | |
\newenvironment{Shaded}{}{} | |
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} | |
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} | |
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} | |
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} | |
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} | |
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} | |
\newcommand{\RegionMarkerTok}[1]{{#1}} | |
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} | |
\newcommand{\NormalTok}[1]{{#1}} | |
% Additional commands for more recent versions of Pandoc | |
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}} | |
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}} | |
\newcommand{\ImportTok}[1]{{#1}} | |
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}} | |
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}} | |
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} | |
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}} | |
\newcommand{\BuiltInTok}[1]{{#1}} | |
\newcommand{\ExtensionTok}[1]{{#1}} | |
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}} | |
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}} | |
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
% Define a nice break command that doesn't care if a line doesn't already | |
% exist. | |
\def\br{\hspace*{\fill} \\* } | |
% Math Jax compatability definitions | |
\def\gt{>} | |
\def\lt{<} | |
% Document parameters | |
\title{ME3263\_Lab-02} | |
% Pygments definitions | |
\makeatletter | |
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% | |
\let\PY@ul=\relax \let\PY@tc=\relax% | |
\let\PY@bc=\relax \let\PY@ff=\relax} | |
\def\PY@tok#1{\csname PY@tok@#1\endcsname} | |
\def\PY@toks#1+{\ifx\relax#1\empty\else% | |
\PY@tok{#1}\expandafter\PY@toks\fi} | |
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{% | |
\PY@it{\PY@bf{\PY@ff{#1}}}}}}} | |
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}} | |
\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} | |
\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}} | |
\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} | |
\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} | |
\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} | |
\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} | |
\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}} | |
\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} | |
\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}} | |
\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}} | |
\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} | |
\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} | |
\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} | |
\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} | |
\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit} | |
\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf} | |
\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}} | |
\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} | |
\expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}} | |
\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} | |
\expandafter\def\csname PY@tok@fm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} | |
\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} | |
\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} | |
\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} | |
\expandafter\def\csname PY@tok@vm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} | |
\expandafter\def\csname PY@tok@sa\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@dl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} | |
\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} | |
\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} | |
\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} | |
\def\PYZbs{\char`\\} | |
\def\PYZus{\char`\_} | |
\def\PYZob{\char`\{} | |
\def\PYZcb{\char`\}} | |
\def\PYZca{\char`\^} | |
\def\PYZam{\char`\&} | |
\def\PYZlt{\char`\<} | |
\def\PYZgt{\char`\>} | |
\def\PYZsh{\char`\#} | |
\def\PYZpc{\char`\%} | |
\def\PYZdl{\char`\$} | |
\def\PYZhy{\char`\-} | |
\def\PYZsq{\char`\'} | |
\def\PYZdq{\char`\"} | |
\def\PYZti{\char`\~} | |
% for compatibility with earlier versions | |
\def\PYZat{@} | |
\def\PYZlb{[} | |
\def\PYZrb{]} | |
\makeatother | |
% Exact colors from NB | |
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5} | |
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0} | |
% Prevent overflowing lines due to hard-to-break entities | |
\sloppy | |
% Setup hyperref package | |
\hypersetup{ | |
breaklinks=true, % so long urls are correctly broken across lines | |
colorlinks=true, | |
urlcolor=urlcolor, | |
linkcolor=linkcolor, | |
citecolor=citecolor, | |
} | |
% Slightly bigger margins than the latex defaults | |
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} | |
\begin{document} | |
\maketitle | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}87}]:} \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k}{as} \PY{n+nn}{np} | |
\PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{stats} \PY{k}{import} \PY{n}{norm}\PY{p}{,} \PY{n}{t} | |
\PY{k+kn}{import} \PY{n+nn}{matplotlib}\PY{n+nn}{.}\PY{n+nn}{pyplot} \PY{k}{as} \PY{n+nn}{plt} | |
\PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k}{as} \PY{n+nn}{pd} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{rcParams}\PY{o}{.}\PY{n}{update}\PY{p}{(}\PY{p}{\PYZob{}}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{font.size}\PY{l+s+s1}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{22}\PY{p}{\PYZcb{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{rcParams}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{lines.linewidth}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{l+m+mi}{3} | |
\PY{k+kn}{import} \PY{n+nn}{check\PYZus{}lab02} \PY{k}{as} \PY{n+nn}{p} | |
\end{Verbatim} | |
\hypertarget{me-3263-introduction-to-sensors-and-data-analysis-fall-2018}{% | |
\section{ME 3263 Introduction to Sensors and Data Analysis (Fall | |
2018)}\label{me-3263-introduction-to-sensors-and-data-analysis-fall-2018}} | |
\hypertarget{lab-2---static-beam-deflections-with-strain-gage}{% | |
\section{Lab \#2 - Static beam deflections with strain | |
gage}\label{lab-2---static-beam-deflections-with-strain-gage}} | |
\hypertarget{what-is-a-strain-gage}{% | |
\section{What is a Strain Gage?}\label{what-is-a-strain-gage}} | |
A strain gage consists of a looped wire that is embedded in a thin | |
backing. Two copper coated tabs serve as solder points for the leads. | |
See Figure 1a. The strain gage is mounted to the structure, whose | |
deformation is to be measured. As the structure deforms, the wire | |
stretches (increasing its net length ) and its electrical resistance | |
changes: \(R=\rho L/A\), where \(\rho\) is the material resistivity, | |
\(L\) is the total length of the wire, and \(A\) is the cross sectional | |
area of the wire. Note that as \(L\) increases, the cross sectional area | |
changes as well due to the Poisson contraction; the resistivity also | |
changes. | |
\begin{figure} | |
\centering | |
\includegraphics{./figure_01.png} | |
\caption{Figure 1: a) A typical strain gage. b) One common setup: the | |
gage is mounted to measure the x-direction strain on the top surface. | |
It's engaged in a quarter bridge configuration of the Wheatstone bridge | |
circuit.} | |
\end{figure} | |
\emph{Figure 1: a) A typical strain gage. b) One common setup: the gage | |
is mounted to measure the x-direction strain on the top surface. It's | |
engaged in a quarter bridge configuration of the Wheatstone bridge | |
circuit.} | |
\hypertarget{digital-image-correlation}{% | |
\section{Digital Image Correlation}\label{digital-image-correlation}} | |
\url{https://github.com/dicengine/dice} | |
\begin{figure} | |
\centering | |
\includegraphics{https://cloud.githubusercontent.com/assets/15202746/26112065/167c12b0-3a14-11e7-8361-a4978dc54bf0.png} | |
\caption{DICe Digital Image Correlation engine} | |
\end{figure} | |
Digital image correlation (DIC) is a method to track movement of groups | |
of pixels with sub-pixel accuracy used in solid mechanics {[}0{]}. A | |
region of interest (ROI)~is chosen, shown in green above, and groups of | |
pixels are tracked in subsequent ``deformed'' images. | |
In this lab, we will use DIC to determine the curvature \(\kappa\) in | |
1/pixels and multiply by the thickness in pixels to determine the strain | |
on the surface of the beam. The kinematics is detailed in the next | |
section ``Validate strain gage measurements'' | |
\hypertarget{validate-static-strain-gage-measurements}{% | |
\section{Validate static strain gage | |
measurements}\label{validate-static-strain-gage-measurements}} | |
In this lab we will calibrate strain measurements using Euler-Bernouli | |
beam theory kinematics {[}1{]}. The axial strain in a beam is directly | |
proportional to the distance from the neutral axis and curvature as such | |
\(\epsilon_x=-\kappa z\). (1) | |
The curvature of the beam is approximated as such | |
\(\kappa=\frac{d^2 w}{dx^2}\). (2) | |
Equations 1 and 2 relate beam deflection to axial strain. These are | |
called kinematic equations because they define the geometry of the beam | |
deflection. | |
The Euler-Bernouli beam theory uses Newton's second law (kinetics) and | |
Hooke's law (constitutive) to derive the linear equations of motion for | |
one dimensional deformable objects {[}1,4{]}. The relation between a | |
static applied force q(x) and static deflection w(x) is as such | |
\(\frac{\partial^2}{\partial x^2}\left(EI\frac{\partial^2 w}{\partial x^2}\right)=q(x)\) | |
(3) | |
where \(E\) is the Young's modulus, \(x\) is the distance along the | |
neutral axis, and \(I\) is the second moment of area of the beam's | |
cross-section. For a rectangular cross-section \(b \times t\), width by | |
thickness the second moment of area is | |
\(I=\frac{bt^3}{12}\). (4) | |
We will design our strain gage validation such that \(E\) and \(I\) are | |
not necessary. The boundary conditions for a clamped beam that is | |
deflected by a distance \(\delta\) are \(w(0)=0\), \(w'(0)=0\), | |
\(w(L)=\delta\), and \(w''(L)=0\). Therefore, the functions \(w(x)\) and | |
\(w''(x)\) can be determined by integrating equation 3 four times and | |
using the four boundary conditions as such | |
\(w(x)=-\frac{1}{2}\left(\frac{\delta}{L^3}x^3-3\frac{\delta}{L^2}x^2\right)\) | |
(5a) | |
and the curvature | |
\(w''(x)=-\left(3\frac{\delta}{L^3}x-3\frac{\delta}{L^2}\right)\) (5b) | |
Using equations 5a-b, the only quantities needed to determine strain at | |
a given location on a linear, homogeneous beam are \(z\), \(\delta\), | |
\(w(L)\), and \(L\). | |
\begin{figure} | |
\centering | |
\includegraphics{./figure_02.png} | |
\caption{Figure 2: Diagram of the validation process. The strain gage is | |
placed at a distance \(x_{SG}\) from the cantilever support. A | |
linear-elastic beam of length \(L\) is deflected by distance, | |
\(\delta\).} | |
\end{figure} | |
\emph{Figure 2: Diagram of the validation process. The strain gage is | |
placed at a distance \(x_{SG}\) from the cantilever support. A | |
linear-elastic beam of length \(L\) is deflected by distance, | |
\(\delta\).} | |
\begin{itemize} | |
\item | |
take a picture using a cross-hair to get the beam as close to | |
horizontal as possible | |
\item | |
Apply a known tip displacement by applying a load on the beam at | |
multiple locations as seen in Figure 2. Measure and record the strain | |
at your strain gage location, the displacement, \(\delta\) and length | |
where load was applied, \(L\). | |
\item | |
take a picture of the deformed beam | |
\item | |
Calculate the strain at the location of the strain gage using | |
equations 1,2, and 5a-b. | |
\end{itemize} | |
Below are two functions that calculate displacement and curvature given | |
a bar of length \texttt{L}, that is deflected by a distance, | |
\texttt{delta}. | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}10}]:} \PY{k}{def} \PY{n+nf}{disp\PYZus{}at\PYZus{}x}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{n}{L}\PY{p}{,}\PY{n}{delta}\PY{p}{)}\PY{p}{:} | |
\PY{l+s+sd}{\PYZsq{}\PYZsq{}\PYZsq{}returns the displacement w(x) given the position, x, } | |
\PY{l+s+sd}{ length of bar, L, and displacement at L, delta\PYZsq{}\PYZsq{}\PYZsq{}} | |
\PY{n}{wx}\PY{o}{=}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{2}\PY{o}{*}\PY{p}{(}\PY{n}{delta}\PY{o}{/}\PY{n}{L}\PY{o}{*}\PY{o}{*}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{x}\PY{o}{*}\PY{o}{*}\PY{l+m+mi}{3}\PY{o}{\PYZhy{}}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{delta}\PY{o}{/}\PY{n}{L}\PY{o}{*}\PY{o}{*}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{x}\PY{o}{*}\PY{o}{*}\PY{l+m+mi}{2}\PY{p}{)} | |
\PY{k}{return} \PY{n}{wx} | |
\PY{k}{def} \PY{n+nf}{k\PYZus{}at\PYZus{}x}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{n}{L}\PY{p}{,}\PY{n}{delta}\PY{p}{)}\PY{p}{:} | |
\PY{l+s+sd}{\PYZsq{}\PYZsq{}\PYZsq{}returns the curvature w\PYZsq{}\PYZsq{}(x) given the position, x, } | |
\PY{l+s+sd}{ length of bar, L, and displacement at L, delta\PYZsq{}\PYZsq{}\PYZsq{}} | |
\PY{n}{wx}\PY{o}{=}\PY{o}{\PYZhy{}}\PY{p}{(}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{delta}\PY{o}{/}\PY{n}{L}\PY{o}{*}\PY{o}{*}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{x}\PY{o}{\PYZhy{}}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{delta}\PY{o}{/}\PY{n}{L}\PY{o}{*}\PY{o}{*}\PY{l+m+mi}{2}\PY{p}{)} | |
\PY{k}{return} \PY{n}{wx} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}7}]:} \PY{n}{w20mm}\PY{o}{=}\PY{n}{disp\PYZus{}at\PYZus{}x}\PY{p}{(}\PY{l+m+mi}{20}\PY{p}{,}\PY{l+m+mi}{400}\PY{p}{,}\PY{l+m+mi}{10}\PY{p}{)} | |
\PY{n}{k20mm}\PY{o}{=}\PY{n}{k\PYZus{}at\PYZus{}x}\PY{p}{(}\PY{l+m+mi}{20}\PY{p}{,}\PY{l+m+mi}{400}\PY{p}{,}\PY{l+m+mi}{10}\PY{p}{)} | |
\PY{n+nb}{print}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{displacement of 400 mm bar deflected 10 mm, 20 mm from support =}\PY{l+s+si}{\PYZpc{}1.3f}\PY{l+s+s1}{ mm}\PY{l+s+s1}{\PYZsq{}}\PY{o}{\PYZpc{}}\PY{k}{w20mm}) | |
\PY{n+nb}{print}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{ curvature of 400 mm bar deflected 10 mm, 20 mm from support =}\PY{l+s+si}{\PYZpc{}1.3f}\PY{l+s+s1}{ 1/m}\PY{l+s+s1}{\PYZsq{}}\PY{o}{\PYZpc{}}\PY{p}{(}\PY{n}{k20mm}\PY{o}{*}\PY{l+m+mi}{1000}\PY{p}{)}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
displacement of 400 mm bar deflected 10 mm, 20 mm from support =0.037 mm | |
curvature of 400 mm bar deflected 10 mm, 20 mm from support =0.178 1/m | |
\end{Verbatim} | |
\hypertarget{problem-1}{% | |
\section{Problem 1}\label{problem-1}} | |
If your beam is 6000 pixels long by 500 pixels thick and it deflects 700 | |
pixels at the tip, determine the following: | |
\begin{enumerate} | |
\def\labelenumi{\alph{enumi}.} | |
\item | |
displacement \texttt{w300} of the beam 3000 pixels from the base | |
\item | |
the curvature \texttt{k300} of the beam 3000 pixels from the base | |
\item | |
the strain \texttt{e300} of the beam 3000 pixels from the base | |
\end{enumerate} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor} }]:} \PY{c+c1}{\PYZsh{} your work here} | |
\PY{n}{p}\PY{o}{.}\PY{n}{check\PYZus{}p01}\PY{p}{(}\PY{n}{w300}\PY{p}{,}\PY{n}{k300}\PY{p}{,}\PY{n}{e300}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}90}]:} \PY{n}{x}\PY{o}{=}\PY{n}{np}\PY{o}{.}\PY{n}{linspace}\PY{p}{(}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{400}\PY{p}{)} | |
\PY{n}{wx}\PY{o}{=}\PY{n}{disp\PYZus{}at\PYZus{}x}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{l+m+mi}{400}\PY{p}{,}\PY{l+m+mi}{10}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{n}{wx}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{xlabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{position along beam (mm)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{ylabel}\PY{p}{(}\PY{l+s+sa}{r}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{deflection of }\PY{l+s+se}{\PYZbs{}\PYZbs{}}\PY{l+s+s1}{neutral axis w(x) (mm)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{title}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{Shape of deflected cantilever beam}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}90}]:} Text(0.5, 1.0, 'Shape of deflected cantilever beam') | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_12_1.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}91}]:} \PY{n}{x}\PY{o}{=}\PY{n}{np}\PY{o}{.}\PY{n}{linspace}\PY{p}{(}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{400}\PY{p}{)} | |
\PY{n}{kx}\PY{o}{=}\PY{n}{k\PYZus{}at\PYZus{}x}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{l+m+mi}{400}\PY{p}{,}\PY{l+m+mi}{10}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{n}{kx}\PY{o}{*}\PY{l+m+mi}{1000}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{xlabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{position along beam (mm)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{ylabel}\PY{p}{(}\PY{l+s+sa}{r}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{curvature }\PY{l+s+se}{\PYZbs{}\PYZbs{}}\PY{l+s+s1}{of neutral axis }\PY{l+s+se}{\PYZbs{}\PYZbs{}}\PY{l+s+s1}{w(x) (1/m)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{title}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{Curvature of deflected cantilever beam}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}91}]:} Text(0.5, 1.0, 'Curvature of deflected cantilever beam') | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_13_1.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
\hypertarget{using-dice-results-files}{% | |
\section{Using DICe results files}\label{using-dice-results-files}} | |
You can load the displacement calculated in DICe into your Python | |
workspace for analysis. Included here is a folder ``results-dice'' with | |
2 images, the reference and the deformed image. The following creates | |
two arrays from the two image analyses (reference = 0 and deformed = 1) | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}92}]:} \PY{n}{data0}\PY{o}{=}\PY{n}{pd}\PY{o}{.}\PY{n}{read\PYZus{}csv}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{./results\PYZhy{}dice/DICe\PYZus{}solution\PYZus{}00.txt}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{data1}\PY{o}{=}\PY{n}{pd}\PY{o}{.}\PY{n}{read\PYZus{}csv}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{./results\PYZhy{}dice/DICe\PYZus{}solution\PYZus{}01.txt}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n}{data0}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{COORDINATE\PYZus{}X}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{o}{+}\PY{n}{data0}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{DISPLACEMENT\PYZus{}X}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{p}{,}\PY{n}{data0}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{COORDINATE\PYZus{}Y}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{o}{+}\PY{n}{data0}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{DISPLACEMENT\PYZus{}Y}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{p}{,}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{o}\PY{l+s+s1}{\PYZsq{}}\PY{p}{,}\PY{n}{label}\PY{o}{=}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{reference}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n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{=}\PY{l+m+mf}{0.}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}92}]:} <matplotlib.legend.Legend at 0x7f652bbe8358> | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_15_1.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
The raw data has two problems: | |
\begin{enumerate} | |
\def\labelenumi{\arabic{enumi}.} | |
\item | |
The deformed image has poorly tracked regions | |
\item | |
The reference image is not a flat line (the camera is tilted) | |
\end{enumerate} | |
We fix these issues with two solutions: | |
\begin{enumerate} | |
\def\labelenumi{\arabic{enumi}.} | |
\item | |
Use a measure of how well the regions were tracked be the image | |
correlation method | |
\item | |
Use best-fit lines to determine the shape of the | |
\end{enumerate} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}93}]:} \PY{n}{data0}\PY{o}{=}\PY{n}{data0}\PY{p}{[}\PY{n}{data1}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{UNCERTAINTY}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{o}{\PYZgt{}}\PY{l+m+mf}{0.05}\PY{p}{]} | |
\PY{n}{data1}\PY{o}{=}\PY{n}{data1}\PY{p}{[}\PY{n}{data1}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{UNCERTAINTY}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{o}{\PYZgt{}}\PY{l+m+mf}{0.05}\PY{p}{]} | |
\PY{n}{X0}\PY{o}{=}\PY{n}{data0}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{COORDINATE\PYZus{}X}\PY{l+s+s1}{\PYZsq{}}\PY{p}{]}\PY{o}{+}\PY{n}{data0}\PY{p}{[}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{DISPLACEMENT\PYZ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}\PY{p}{,}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{o}\PY{l+s+s1}{\PYZsq{}}\PY{p}{,}\PY{n}{label}\PY{o}{=}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{deformed}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{xlabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{camera x\PYZhy{}axis}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{ylabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{camera y\PYZhy{}axis}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{legend}\PY{p}{(}\PY{n}{bbox\PYZus{}to\PYZus{}anchor}\PY{o}{=}\PY{p}{(}\PY{l+m+mf}{1.05}\PY{p}{,} \PY{l+m+mi}{1}\PY{p}{)}\PY{p}{,} \PY{n}{loc}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{borderaxespad}\PY{o}{=}\PY{l+m+mf}{0.}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}93}]:} <matplotlib.legend.Legend at 0x7f652acbb828> | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_17_1.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
In the graph above all the points with `UNCERTAINTY'\textless{}0.05 were | |
removed. This is a measure made during the cross-correlation method | |
{[}0{]}. | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}94}]:} \PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{optimize} \PY{k}{import} \PY{n}{curve\PYZus{}fit} | |
\PY{k}{def}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PY{p}{]} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}95}]:} \PY{n}{Y0\PYZus{}fit}\PY{o}{=}\PY{n}{reference\PYZus{}line}\PY{p}{(}\PY{n}{X0}\PY{p}{,}\PY{n}{A0}\PY{p}{,}\PY{n}{B0}\PY{p}{)} | |
\PY{n}{Y1\PYZus{}fit}\PY{o}{=}\PY{n}{deformed\PYZus{}line}\PY{p}{(}\PY{n}{X1}\PY{p}{,}\PY{n}{A1}\PY{p}{,}\PY{n}{B1}\PY{p}{,}\PY{n}{C1}\PY{p}{,}\PY{n}{D1}\PY{p}{,}\PY{n}{E1}\PY{p}{)} | |
\PY{n}{x\PYZus{}fit}\PY{o}{=}\PY{n}{np}\PY{o}{.}\PY{n}{linspace}\PY{p}{(}\PY{n}{np}\PY{o}{.}\PY{n}{min}\PY{p}{(}\PY{n}{X0}\PY{p}{)}\PY{p}{,}\PY{n}{np}\PY{o}{.}\PY{n}{max}\PY{p}{(}\PY{n}{X0}\PY{p}{)}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n}{X0}\PY{p}{,}\PY{n}{Y0}\PY{o}{\PYZhy{}}\PY{n}{Y0\PYZus{}fit}\PY{p}{,}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{o}\PY{l+s+s1}{\PYZsq{}}\PY{p}{,}\PY{n}{label}\PY{o}{=}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{reference}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n}{X1}\PY{p}{,}\PY{n}{Y1}\PY{o}{\PYZhy{}}\PY{n}{Y0\PYZus{}fit}\PY{p}{,}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{o}\PY{l+s+s1}{\PYZsq{}}\PY{p}{,}\PY{n}{label}\PY{o}{=}\PY{l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+mf}{1.05}\PY{p}{,} \PY{l+m+mi}{1}\PY{p}{)}\PY{p}{,} \PY{n}{loc}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{borderaxespad}\PY{o}{=}\PY{l+m+mf}{0.}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}95}]:} <matplotlib.legend.Legend at 0x7f652ae3b240> | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_20_1.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
In the figure above, we have done 3 things: | |
\begin{enumerate} | |
\def\labelenumi{\arabic{enumi}.} | |
\item | |
removed the untracked sections of the beam | |
\item | |
subtracted a line of best fit for the reference and deformed images | |
\item | |
plotted the displacement of the beam | |
\end{enumerate} | |
\hypertarget{problem-2}{% | |
\section{Problem 2}\label{problem-2}} | |
Based upon the deformation from the reference to the deformed | |
configuration, write a function that returns the strain on the surface | |
of the deformed beam if the beam is 7 pixels thick. *Hint: you'll have | |
to calculate the second derivative of the displacement and use | |
\$\epsilon = -z\kappa | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}1}]:} \PY{k}{def} \PY{n+nf}{strain\PYZus{}in\PYZus{}beam}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{n}{A}\PY{p}{,}\PY{n}{B}\PY{p}{,}\PY{n}{C}\PY{p}{,}\PY{n}{D}\PY{p}{,}\PY{n}{E}\PY{p}{)}\PY{p}{:} | |
\PY{l+s+sd}{\PYZsq{}\PYZsq{}\PYZsq{}function to return the strain in a beam that has the shape:} | |
\PY{l+s+sd}{ w(x) = A*x**4+B*x**3+C*x**2+D*x+E} | |
\PY{l+s+sd}{ the thickness of the beam is t=7 px in this case\PYZsq{}\PYZsq{}\PYZsq{}} | |
\PY{n}{t}\PY{o}{=}\PY{l+m+mi}{6} | |
\PY{c+c1}{\PYZsh{} your work here e=...} | |
\PY{k}{return} \PY{n}{e} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor} }]:} \PY{k+kn}{import} \PY{n+nn}{check\PYZus{}lab02} \PY{k}{as} \PY{n+nn}{p} | |
\PY{n}{p}\PY{o}{.}\PY{n}{check\PYZus{}p02}\PY{p}{(}\PY{n}{strain\PYZus{}in\PYZus{}beam}\PY{p}{)} | |
\end{Verbatim} | |
\hypertarget{measure-constitutive-properties}{% | |
\section{Measure constitutive | |
properties}\label{measure-constitutive-properties}} | |
\hypertarget{constitutive-model}{% | |
\subsection{Constitutive Model}\label{constitutive-model}} | |
Now the strain gage should be calibrated. We need to determine the | |
Young's modulus, \(E\) and second moment of area, \(I\). This | |
measurement requires three components: kinematic (which we solved in the | |
validation), kinetic (\(\sum{F}=0\)), and a constitutive model (Hooke's | |
Law). The constitutive equation for a linear-elastic beam subject to a | |
moment is as such | |
\(M=EI\kappa\). (6) | |
In equation 6, \(M\) is the applied moment, \(E\) is the Young's | |
modulus, \(I\) is the second moment of inertia of the area of the beam, | |
and \(\kappa\) is the curvature of the beam. The constant \(I\) is based | |
upon the geometry from equation 4. The material constant \(E\) is | |
unknown. | |
Use the weights to apply forces at different distances, \(r\), from the | |
support as seen in Figure 3. Increasing the weight or the distance the | |
weight is applied will increase the applied moment. Use Table 1 to | |
record the trial no., strain, force, distance, and moment. Use at least | |
two trials per measurement. | |
\begin{figure} | |
\centering | |
\includegraphics{./figure_03.png} | |
\caption{Figure 3: A linear-elastic beam of length \(L\) has a force | |
applied at distance, \(r\). The strain gage is placed at a distance | |
\(x_{SG}\) from the cantilever support.} | |
\end{figure} | |
\emph{Figure 3: A linear-elastic beam of length \(L\) has a force | |
applied at distance, \(r\). The strain gage is placed at a distance | |
\(x\) from the cantilever support.} | |
\hypertarget{fitting-your-data-to-your-model}{% | |
\subsection{Fitting your data to your | |
model}\label{fitting-your-data-to-your-model}} | |
Once you have filled in a number of data points for \(\kappa\) and | |
\(M\), you can use a linear regression to determine the slope of the | |
data. The constitutive model in equation (6) predicts that the moment | |
and curvature will be related by a proportional constant, \(EI\). If we | |
know \(EI\), the total squared error is as such | |
\(SSE=\sum_i^N{(M_i-EI\kappa_i)^2}\) (7) | |
where SSE is the sum of squares error between the predicted moment and | |
measured moment for the \(i^{th}\) measurement with \(N\) total | |
measurements | |
\href{https://www.amazon.com/Numerical-Methods-Engineers-Steven-Chapra/dp/0073401064}{{[}2{]}}. | |
We can choose a of \(EI\) that minimizes \(SSE\), but it will never be | |
zero. Below is an example calculation for a linear least squares | |
regression in python for a beam with cross-section \(12\times3\) mm. | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}7}]:} \PY{n}{k}\PY{o}{=}\PY{n}{np}\PY{o}{.}\PY{n}{array}\PY{p}{(}\PY{p}{[}\PY{l+m+mf}{6.95685737e\PYZhy{}07}\PY{p}{,} \PY{l+m+mf}{9.93992373e\PYZhy{}06}\PY{p}{,} \PY{l+m+mf}{3.25200211e\PYZhy{}05}\PY{p}{,} \PY{l+m+mf}{3.55750721e\PYZhy{}05}\PY{p}{,} | |
\PY{l+m+mf}{5.32023782e\PYZhy{}05}\PY{p}{,} \PY{l+m+mf}{7.48128585e\PYZhy{}05}\PY{p}{,} \PY{l+m+mf}{7.61625461e\PYZhy{}05}\PY{p}{,} \PY{l+m+mf}{8.54476229e\PYZhy{}05}\PY{p}{,} | |
\PY{l+m+mf}{1.02089509e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{1.02841452e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{1.32351731e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{1.43996022e\PYZhy{}04}\PY{p}{,} | |
\PY{l+m+mf}{1.45204793e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{1.56867759e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{1.73435915e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{1.95625232e\PYZhy{}04}\PY{p}{,} | |
\PY{l+m+mf}{2.00670618e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{2.12900332e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{2.24582886e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{2.41141396e\PYZhy{}04}\PY{p}{,} | |
\PY{l+m+mf}{2.45991618e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{2.55608426e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{2.76117673e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{2.96128593e\PYZhy{}04}\PY{p}{,} | |
\PY{l+m+mf}{3.07157389e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{3.20509718e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{3.20363196e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{3.35535814e\PYZhy{}04}\PY{p}{,} | |
\PY{l+m+mf}{3.53706984e\PYZhy{}04}\PY{p}{,} \PY{l+m+mf}{3.64130433e\PYZhy{}04}\PY{p}{]}\PY{p}{)} | |
\PY{n}{M}\PY{o}{=}\PY{n}{np}\PY{o}{.}\PY{n}{array}\PY{p}{(}\PY{p}{[} \PY{l+m+mf}{0.} \PY{p}{,} \PY{l+m+mf}{23.82866379}\PY{p}{,} \PY{l+m+mf}{47.65732759}\PY{p}{,} \PY{l+m+mf}{71.48599138}\PY{p}{,} | |
\PY{l+m+mf}{95.31465517}\PY{p}{,} \PY{l+m+mf}{119.14331897}\PY{p}{,} \PY{l+m+mf}{142.97198276}\PY{p}{,} \PY{l+m+mf}{166.80064655}\PY{p}{,} | |
\PY{l+m+mf}{190.62931034}\PY{p}{,} \PY{l+m+mf}{214.45797414}\PY{p}{,} \PY{l+m+mf}{238.28663793}\PY{p}{,} \PY{l+m+mf}{262.11530172}\PY{p}{,} | |
\PY{l+m+mf}{285.94396552}\PY{p}{,} \PY{l+m+mf}{309.77262931}\PY{p}{,} \PY{l+m+mf}{333.6012931} \PY{p}{,} \PY{l+m+mf}{357.4299569} \PY{p}{,} | |
\PY{l+m+mf}{381.25862069}\PY{p}{,} \PY{l+m+mf}{405.08728448}\PY{p}{,} \PY{l+m+mf}{428.91594828}\PY{p}{,} \PY{l+m+mf}{452.74461207}\PY{p}{,} | |
\PY{l+m+mf}{476.57327586}\PY{p}{,} \PY{l+m+mf}{500.40193966}\PY{p}{,} \PY{l+m+mf}{524.23060345}\PY{p}{,} \PY{l+m+mf}{548.05926724}\PY{p}{,} | |
\PY{l+m+mf}{571.88793103}\PY{p}{,} \PY{l+m+mf}{595.71659483}\PY{p}{,} \PY{l+m+mf}{619.54525862}\PY{p}{,} \PY{l+m+mf}{643.37392241}\PY{p}{,} | |
\PY{l+m+mf}{667.20258621}\PY{p}{,} \PY{l+m+mf}{691.03125} \PY{p}{]}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}20}]:} \PY{k+kn}{from} \PY{n+nn}{scipy}\PY{n+nn}{.}\PY{n+nn}{optimize} \PY{k}{import} \PY{n}{curve\PYZus{}fit} | |
\PY{k}{def} \PY{n+nf}{func}\PY{p}{(}\PY{n}{x}\PY{p}{,}\PY{n}{EI}\PY{p}{)}\PY{p}{:} | |
\PY{k}{return} \PY{n}{EI}\PY{o}{*}\PY{n}{x} | |
\PY{n}{EI}\PY{p}{,}\PY{n}{pcov}\PY{o}{=}\PY{n}{curve\PYZus{}fit}\PY{p}{(}\PY{n}{func}\PY{p}{,} \PY{n}{k}\PY{p}{,} \PY{n}{M}\PY{p}{)} | |
\PY{n}{EI\PYZus{}error}\PY{o}{=}\PY{n}{np}\PY{o}{.}\PY{n}{sqrt}\PY{p}{(}\PY{n}{pcov}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{)} | |
\PY{n}{I}\PY{o}{=}\PY{l+m+mi}{12}\PY{o}{*}\P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{n}{xlabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{curvature (1/m)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{ylabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{Moment (N\PYZhy{}mm)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
Best fit for Young's Modulus is 70.2 +/- 0.3 GPa | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}20}]:} Text(0,0.5,'Moment (N-mm)') | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_28_2.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
\emph{Note:} | |
The least-squares method used above can be used to fit any function to a | |
data set. You would just need to update the \texttt{func} definition to | |
return the desired function based upon your unkown fitting constants. | |
The outout \texttt{popt} is the covariance matrix | |
\href{./least_squares-error_with_covariance.pdf}{{[}3{]}}. In practice, | |
we can use the square root of the diagonal terms to estimate the error | |
in our least-squares fit. We make a few assumptions when performing this | |
best-fit: | |
\begin{enumerate} | |
\def\labelenumi{\arabic{enumi}.} | |
\item | |
There is a random error in the measured dependent variable (here the | |
moment \(M\)). | |
\item | |
There is no error in the reported independent variable (here the | |
curvature \(\kappa\)). | |
\item | |
The measured dependent variables are uncorrelated with the measured | |
error | |
\item | |
The random error has a mean of zero | |
\end{enumerate} | |
We can test assumption 4 by plotting the ``residuals'' of the fit | |
i.e.~the error. The plot below demonstrates that our data has a mean | |
error of 0 and is uncorrelated with the | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{incolor}In [{\color{incolor}25}]:} \PY{n}{plt}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{n}{k}\PY{o}{*}\PY{l+m+mf}{1e3}\PY{p}{,}\PY{n}{M}\PY{o}{\PYZhy{}}\PY{n}{func}\PY{p}{(}\PY{n}{k}\PY{p}{,}\PY{n}{EI}\PY{p}{)}\PY{p}{,}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{o}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{xlabel}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{curvature (1/m)}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\PY{n}{plt}\PY{o}{.}\PY{n}{ylabel}\PY{p}{(}\PY{l+s+sa}{r}\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{Error=\PYZdl{}M\PYZhy{}EI}\PY{l+s+s1}{\PYZbs{}}\PY{l+s+s1}{kappa\PYZdl{}}\PY{l+s+s1}{\PYZsq{}}\PY{p}{)} | |
\end{Verbatim} | |
\begin{Verbatim}[commandchars=\\\{\}] | |
{\color{outcolor}Out[{\color{outcolor}25}]:} Text(0,0.5,'Error=\$M-EI\textbackslash{}\textbackslash{}kappa\$') | |
\end{Verbatim} | |
\begin{center} | |
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_30_1.png} | |
\end{center} | |
{ \hspace*{\fill} \\} | |
\emph{Table 1: Fill in the measured and calculated values.} | |
\begin{longtable}[]{@{}llllll@{}} | |
\toprule | |
trial & distance, \(r\) & force= \(mg\) & strain (mm/mm) & curvature | |
(1/mm) & Moment=\(r\times F\)\tabularnewline | |
\midrule | |
\endhead | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
1 & & & & &\tabularnewline | |
& & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
2 & & & & &\tabularnewline | |
\bottomrule | |
\end{longtable} | |
\hypertarget{your-report}{% | |
\subsubsection{Your Report}\label{your-report}} | |
\begin{enumerate} | |
\def\labelenumi{\arabic{enumi}.} | |
\item | |
Introduction | |
\item | |
Procedure | |
\item | |
Results and Discussion | |
\item | |
Conclusion | |
\end{enumerate} | |
\hypertarget{references}{% | |
\subsubsection{References}\label{references}} | |
References | |
\begin{enumerate} | |
\def\labelenumi{\arabic{enumi}.} | |
\setcounter{enumi}{-1} | |
\item | |
Sutton, M. A., Orteu, J. J., \& Schreier, H. (2009). Image correlation | |
for shape, motion and deformation measurements: basic concepts, theory | |
and applications. Springer Science \& Business Media. | |
\item | |
F.P. Beer and E.R. Johnson, Mechanics of Materials, 2nd Edition, | |
McGraw-Hill, 1992. | |
\item | |
S. Chapra, Numerical Methods for Engineers, ch.~14-15, 6th Edition, | |
McGraw-Hill, 2009. | |
\item | |
\href{./least_squares-error_with_covariance.pdf}{C. Salter, Error | |
Analysis Using the Variance--Covariance Matrix, J. of Chem. Ed., | |
2000.} | |
\item | |
\href{https://en.wikipedia.org/wiki/Euler\%E2\%80\%93Bernoulli_beam_theory}{Euler-Bernoulli | |
Beam Theory - Wikipedia} | |
\item | |
\href{https://courses.washington.edu/phys431/uncertainty_notes.pdf}{Uncertainty | |
Notes courses.washington.edu} | |
\end{enumerate} | |
% Add a bibliography block to the postdoc | |
\end{document} |