A casual approach to numerical modeling

Similar documents
<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. < 1. Introduction: Chart naming: by George Lungu

Projectile Motion Tutorial #2 - animating the

<excelunusual.com> Creating, Sizing, Translating and Rotating 2D Shapes in Excel by George Lungu. < 1

Building a game of Tetris #1 the generation and the rotation of the Tetris parts

Three-Dimensional (Surface) Plots

How to use Excel Spreadsheets for Graphing

Excel 2016 Intermediate for Windows

Chapter 3: Rate Laws Excel Tutorial on Fitting logarithmic data

0 Graphical Analysis Use of Excel

Understand and plan a chart Create a chart Move and resize charts and chart objects Apply chart layouts and styles

Pre-Lab Excel Problem

The American University in Cairo. Academic Computing Services. Excel prepared by. Maha Amer

Microsoft Excel Using Excel in the Science Classroom

- a 2D projectile motion model using numerical analysis of projectile dynamics (including aerodynamic drag) < by George Lungu1

Data Management Project Using Software to Carry Out Data Analysis Tasks

download instant at

Open a new Excel workbook and look for the Standard Toolbar.

Technology Assignment: Scatter Plots

Open Excel by following the directions listed below: Click on Start, select Programs, and the click on Microsoft Excel.

Select the Points You ll Use. Tech Assignment: Find a Quadratic Function for College Costs

Tutorial 9. Review. Data Tables and Scenario Management. Data Validation. Protecting Worksheet. Range Names. Macros

Homework 1 Excel Basics

A cell is highlighted when a thick black border appears around it. Use TAB to move to the next cell to the LEFT. Use SHIFT-TAB to move to the RIGHT.

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving Excel Tutorial VIII

PRACTICAL EXERCISE 1.1.6b

BioFuel Graphing instructions using Microsoft Excel 2003 (Microsoft Excel 2007 instructions start on page mei-7)

Microsoft Excel Chapter 1. Creating a Worksheet and a Chart

Pivot Tables, Lookup Tables and Scenarios

Excel Spreadsheets and Graphs

Microsoft PowerPoint 2007 Tutorial

UW Department of Chemistry Lab Lectures Online

1 THE PNP BASIC COMPUTER ESSENTIALS e-learning (MS Powerpoint 2007)

Years after US Student to Teacher Ratio

Please consider the environment before printing this tutorial. Printing is usually a waste.

Chapter 4. Microsoft Excel

SUM - This says to add together cells F28 through F35. Notice that it will show your result is

Abdulbasit H. Mhdi Assistant lecturer Chemical engineering/ Tikrit University

Reference Services Division Presents. Excel Introductory Course

Chemistry 30 Tips for Creating Graphs using Microsoft Excel

Excel Primer CH141 Fall, 2017

VIDYA SAGAR COMPUTER ACADEMY. Excel Basics

Microsoft Excel 2007

Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9

SBCUSD IT Training Program. MS Excel lll. VLOOKUPS, PivotTables, Macros, and More

Candy is Dandy Project (Project #12)

Spreadsheet Applications Test

Microsoft Excel 2016

Getting Started With Excel

11.1 Create Speaker Notes Print a Presentation Package a Presentation PowerPoint Tips... 44

LABORATORY 1 Data Analysis & Graphing in Excel

Microsoft Excel Chapter 1. Creating a Worksheet and an Embedded Chart

A Basic Flight Simulator in Excel #3 calculating the

Project 4 Financials (Excel)

Microsoft Excel > Shortcut Keys > Shortcuts

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1

Excel Simulations - 1

Getting Started with DADiSP

Physics 211 E&M and Modern Physics Spring Lab #1 (to be done at home) Plotting with Excel. Good laboratory practices

Spreadsheet View and Basic Statistics Concepts

Scientific Graphing in Excel 2013

Table of Contents Getting Started with Excel Creating a Workbook

Reference and Style Guide for Microsoft Excel

Day : Date : Objects : Open MS Excel program * Open Excel application. Select : start. Choose: programs. Choose : Microsoft Office.

Intermediate Microsoft Excel (Demonstrated using Windows XP) Using Spreadsheets in the Classroom

SAMLab Tip Sheet #5 Creating Graphs

Introduction to Spreadsheets

Models for Nurses: Quadratic Model ( ) Linear Model Dx ( ) x Models for Doctors:

1 Introduction to Using Excel Spreadsheets

Excel Manual X Axis Labels Below Chart 2010 Scatter

Setup Mount the //geobase/geo4315 server and add a new Lab2 folder in your user folder.

Total Number of Students in US (millions)

Experiment 1 CH Fall 2004 INTRODUCTION TO SPREADSHEETS

ECE 304: Using EXCEL Preliminaries...3 Construction of Spreadsheet...3 Figure 1:...3 FORMAT CELLS menu with selected font settings...

Getting Acquainted with Office 2007 Table of Contents

MICROSOFT EXCEL TUTORIAL

Outline. More on Excel. Review Entering Formulas. Review Excel Basics Home tab selected here Tabs Different ribbon commands. Copying Formulas (2/2)

Intermediate Excel Training Course Content

= 3 + (5*4) + (1/2)*(4/2)^2.

Scientific Graphing in Excel 2007

Excel 2013 Charts and Graphs

MICROSOFT EXCEL KEYBOARD SHORCUTS

What we will learn in Introduction to Excel. How to Open Excel. Introduction to Excel 2010 Lodi Memorial Library NJ Developed by Barb Hauck-Mah

2. This is a cell; this cell is designated as A1.

Microsoft Excel. Charts

Workbooks (File) and Worksheet Handling

Microsoft Word for Report-Writing (2016 Version)

lab MS Excel 2010 active cell

Starting Excel application

Charts in Excel 2003

Chapter 13. Creating Business Diagrams with SmartArt. Creating SmartArt Diagrams

KINETICS CALCS AND GRAPHS INSTRUCTIONS

Microsoft How to Series

Beginning Excel. Revised 4/19/16

addition + =5+C2 adds 5 to the value in cell C2 multiplication * =F6*0.12 multiplies the value in cell F6 by 0.12

PHLI Instruction (734) Introduction. Lists.

MOVING FROM CELL TO CELL

Table of Contents. 1. Creating a Microsoft Excel Workbook...1 EVALUATION COPY

HOUR 12. Adding a Chart

Data Service Center May, Compiled by: Katey Semmel Donna Frieze

for secondary school teachers & administrators

Transcription:

A casual approach to numerical modeling Spring-Mass-Damper System - part 2. by George Lungu <excelunusual.com> It contains a tutorial about the implementation of a static SMD model in Excel <www.excelunusual.com> 2003 1

Use Excel to make a simple accounting style spread sheet with few hundred time steps and adjustable oscillation parameters. Name this workbook Osc_1. <www.excelunusual.com> 2

Start with label cells : Cell A1: M = Cell A2: K Cell A3: DC Cell A4: Delta t = Cell B7: t Cell C7: a Cell D7: v Cell E7: x Continue with parameter cells (customizable constants): Cell B1: 1 Cell B2: 1 Cell B3: 0.3 Cell B4: 1 Cell B8: 0 Cell D8: 0 Cell E8: -0.3 Finish up with active formula cells : Cell B9: =B8+B$4 Cell C9: =-(E8*B$2+D8*B$3*2*SQRT(B$1*B$2))/B$1 Cell D9: =D8+C9*B$4 Cell E9: =E8+D9*B$4 <www.excelunusual.com> 3

<www.excelunusual.com> 4 Next, copy the range of B9:E9 all the way down to B1008:E1008 And we are almost ready to simulate after we display the coordinate x (E8:E1008) function of time t (B8:B1008) in a scatter plot. Note: There is a small deviation from the initial formulas, namely in cell C9 the damping coefficient was scaled by 2*sqrt(M*K). This way the unit threshold for the damping coefficient indicated the onset of oscillation regardless of the mass or elastic constant of the spring.

<www.excelunusual.com> 5 Create the chart Click on an empty cell -> Insert -> Chart -> -> XY (Scatter) -> Finish

<www.excelunusual.com> 6 Create the chart Right click on the chart window -> Source Data -> Series -> Add

We highlight: (B8:B1008) for the X Values (E8:E1008) for the Y Values (Detail) ending up with something like this -> then click OK <www.excelunusual.com> 7

Highlight and delete the legend Adjust your axes scale and fonts to your liking Add title and axes captions if you wish Format the plot area and the grid lines Format data series Use the Help menu for any or more of these options <www.excelunusual.com> 8

Create buttons by doing the following operations: View -> Toolbars -> Control Toolbox -> Design Mode Drag a Spin Button from the palette onto the sheet. Size the button accordingly, then copy the button 3 times and place them in cells C1, C2, C3, C4 <www.excelunusual.com> 9

<www.excelunusual.com> 10 Right click on each button, select Properties and change the following features (in red): Placement Name: Min: Max: Button # 1 Cell C1 M 1 50 Button # 2 Cell C2 K 1 50 Button # 3 Cell C3 DC 0 100 Button # 4 Cell C4 delta_t 1 50 After you finish, click Exit Design Mode on the Control Toolbox, then close the Control Toolbox.

Create the macros: Hit Alt-F11 and bring up the macro editor. Selecting the current sheet on the left side, type the following macros to the right side (the editor space) : Private Sub M_Change() Range("B1") = M.Value / 10 End Sub Private Sub K_Change() Range("B2") = K.Value / 10 End Sub Private Sub DC_Change() Range("B3") = DC.Value / 50 End Sub Private Sub delta_t_change() Range("B4") = delta_t.value / 100 End Sub <www.excelunusual.com> 11

Few cases: Underdamped Criticallydamped Overdamped <www.excelunusual.com> 12

<www.excelunusual.com> 13 Let s have a look at worksheet Osc_2: Animation My father is a physics teacher and I heard him lecturing many times since I was a little child. Though I had an inner admiration for his craft I found it boring. Occasionally though I had the chance to visit the school s physics lab where all the sterile theory came to life. To get both, maximum motivation and impact on audience, it is nice to mix science with show. Ideally we need the following: - interesting real life examples - animation and real-time simulation - on-the-fly parameter controls - colors and possibly sounds

How do we animate our simulation? For now, let s just have a circle floating in space on an XY scatter plot. The y coordinate will be zero but the x coordinate of the circle will correspond to the x coordinate of our simulation at different moments in time. 1 2 3 4 5 6 7 8 Start by copying the workbook into a new workbook called Osc_2 time [s] <www.excelunusual.com> 14

Let s add the following information: Label cells : Cell A5: Increment Cell G24: X_mass Cell H24: Y_mass Parameter cells (customizable constants): Cell B5: 0 - integer representing the time step, this cell will contain the simulation increment which is can go from 0 to 1000 and it is driven by a macro. Cell H25: 0 - represents the y coordinate of the mass Active formula cells: Cell G25: =OFFSET(E8,B5,0) This cell will display the x coordinate of the mass M at the time step displayed in cell B5. <www.excelunusual.com> 15

Create an XY scatter plot having the following source data: x = Range( G25 ), y = Range( H25 ) <www.excelunusual.com> 16 Also go to: View -> Tool Bars -> Draw Create a green textbox with the word Start inside New text box New Chart

The new chart and its source data <www.excelunusual.com> 17

We need to write the following macro which would run cell B5 as a counter from 0 to 1000 allowing the x coordinate of the mass to change: Sub Start() For i = 0 To 1000 DoEvents Range("B5") = i Next i End Sub Right click the Start button and assign the above macro to it <www.excelunusual.com> 18

Outline of the static old static model Time Untol now we have had a static simulation since all the model calculations are in a fixed table t a v x 0 0-0.3 0.15 0.3 0.045-0.29325 0.3 0.28965 0.088448-0.27998 0.45 0.272907-0.27998 0.6 0.279983 0.041997-0.27368 0.75 0.270323 0.082546-0.2613 0.9 0.254698 0.120751-0.24319 1.05 0.233529 0.15578-0.21982 1.2 0.207359 0.186884-0.19179 1.35 0.176839 0.21341-0.15978 1.5 0.142705 0.234815-0.12456 1.65 0.10577 0.250681-0.08695 1.8 0.066899 0.260716-0.04785 1.95 0.026989 0.264764-0.00813 Initial conditions Formulas In this model the number of time steps is equal to the number of rows in the table of formulas <www.excelunusual.com> 19

Advantages of the static model: 1. Programming ease (minimal VBA code) 2. Speed. The computation is parallel and Excel is optimized for this. The speed of running numerical modeling in Excel is very good exceeding Simulink for instance (exception is Excel 2007 which is a dog and should be avoided if possible) Drawbacks of the static model: 1. Large files (the number of redundant formulas is proportional to the number of time steps) 2. Short runs. The number of time steps is limited to about 65000 in Excel 2003 or earlier <www.excelunusual.com> 20