Microsoft Word - Lab12.docx ENGR 102 - Lab 12 Activity #1: Functions and Arrays This activity will focus on using numpy arrays and plotting. We will look at an exponential damped sinusoid, an equation...

View attached file


Microsoft Word - Lab12.docx ENGR 102 - Lab 12 Activity #1: Functions and Arrays This activity will focus on using numpy arrays and plotting. We will look at an exponential damped sinusoid, an equation useful in describing the dynamic response of engineered systems. Where: A is the initial amplitude (the highest peak), λ is the decay constant, φ is the phase angle (at t = 0) ω is the angular frequency. t is time For our problem, assume the initial amplitude at t = 0 is 2; the decay constant, l, is 1; the angular frequency, w, will vary; and, the phase angle, f, is 0. Perform the following: • Create an array of angular frequencies that contain 0.1, 1, and 10. • Create an array of time from 0 to 3p of 91 equally spaced points. • Evaluate the function y(t) for the values of t and w above. • Plot the results. Use three different curves for the different angular frequencies. The curves should have different colors (do not use red or blue) and line styles but no markers. The plot should include grid lines, axis labels, title, and a legend. The legend should list each curve by the angular frequency. • Include a solid red line on the plot corresponding to the function Ae-lt • Add two blue dotted lines at y = -0.1 and 0.1 for all values of t. • Save your plot using the file name outlined below in the submission requirents. Name your program Lab12_Act1.py and figure Lab12_Act1.png and submit to eCampus. This activity will be manually graded. Activity #2: File Handles Assume you have a file named data.txt saved in the current working directory that looks like the following: Time,GX,GY,GZ 0.27,1.01,0.02,16.85 0.401,1.03,0.04,16.92 0.531,1.04,0.04,16.89 0.661,1.05,0.01,16.86 Answer the following questions: 1. What is printed to the screen when the following snippet of code is interpreted? fid = open(‘data.txt’,’r’) A = fid.read() print(A) fid.close() 2. What is printed to the screen when the following snippet of code is interpreted? with open(‘data.txt’,’r’) as fid: A = fid.readlines() print(A) 3. What is printed to the screen when the following snippet of code is interpreted? fid = open(‘data.txt’,’r’) A = fid.readline() print(A) B = fid.read() print(B) fid.seek(0) fid.seek(15) C = fid.readline() print(C) fid.close()
Nov 06, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here