IT1005 Lab session on week 11 (7 th meeting) 1 or 2 more weeks to go…

Slides:



Advertisements
Similar presentations
The Basics of Physics with Calculus – Part II
Advertisements

Using MatLab and Excel to Solve Building Energy Simulation Problems Jordan Clark
Lab session on week 12 (8th meeting) 1 more week to go…
Intro to CIT 594
CS 282.  Any question about… ◦ SVN  Permissions?  General Usage? ◦ Doxygen  Remember that Project 1 will require it  However, Assignment 2 is good.
SOLVING QUADRATICS General Form: Where a, b and c are constants.
Åbo Akademi University & TUCS, Turku, Finland Ion PETRE Andrzej MIZERA COPASI Complex Pathway Simulator.
Grade 10 Science Motion Unit.
RF-electronics, preparatory I Jorma Lehtonen Jari Kangas.
Chapter 6 Exploring Quadratic Functions and Inequalities
IT1005 Lab session on week 5. About your Lab TA Name: Steven Halim (Indonesian) Occupation: – Full time teaching assistant – Part time PhD student Not.
ECE 3336 Introduction to Circuits & Electronics
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
Solution Sets of Linear Systems (9/21/05)
Dynamical Systems Analysis II: Evaluating Stability, Eigenvalues By Peter Woolf University of Michigan Michigan Chemical Process Dynamics.
Mr Barton’s Maths Notes
MTH-471 Integral Equations Sheikh Irfan Ullah Khan Assistant Professor Department of Mathematics COMSTAS Institute of Information Technology.
EGR 105 Foundations of Engineering I Fall 2007 – Week 3.
6&7-2 Dynamics, two examples of the use of ode45. Numeric Integration using trapz and quad/quadl functions. Readings: Matlab by Pratap Chapter 5.4,5.5.
Gateway Quiz Reminders: The next Gateway will be given in class next week or the week after )check your course calendar.) Before then, each student who.
Non-Linear Simultaneous Equations
Please open your laptops, log in to the MyMathLab course web site, and open Quiz 3.3/4 IMPORTANT NOTE: If you have time left you finish this quiz, use.
EPSII 59:006 Spring Topics Using TextPad If Statements Relational Operators Nested If Statements Else and Elseif Clauses Logical Functions For Loops.
Lab session on week 13 (9th/last meeting) After this, good bye…
Jon Piperato Calculus Grades 11-12
Chapter 10 Review: Matrix Algebra
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Unit 1 Understanding Numeric Values, Variability, and Change 1.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Kinematics in One Dimension. Mechanics Kinematics (Chapter 2 and 3) The movement of an object itself Concepts needed to describe motion without reference.
ME 1202: Linear Algebra & Ordinary Differential Equations (ODEs)
Amber Annett David Bell October 13 th, What will happen What is this business about personal web pages? Designated location of your own web page.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
1 Project Information and Acceptance Testing Integrating Your Code Final Code Submission Acceptance Testing Other Advice and Reminders.
Lecture 16 Solving the Laplace equation in 2-D Remember Phils Problems and your notes = everything Only 6 lectures.
WEEK 8 SYSTEMS OF EQUATIONS DETERMINANTS AND CRAMER’S RULE.
Lecture 14: Stability and Control II Reprise of stability from last time The idea of feedback control Remember that our analysis is limited to linear systems.
Boundary Value Problems and Least Squares Minimization
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
An Introduction to MathCAD Finding Solutions and Symbolic Maths.
IT1005 Lab session on week 10 (6 th meeting) Roughly 3 more weeks to end of the semester! Busy weeks for IT1005, but hang on…!
Displacement and Acceleration
CS 123 Engineering Computation Lab Lab 2 Dan De Sousa and Bruce Char Department of Computer Science Drexel University April 2009 ©By the author. All rights.
IT1005 Lab session on week 9 (5 th meeting) Good Friday and Happy Easter to all students, especially for those who understand the meaning and celebrate.
Beginning Programming for Engineers
22/11/ Selection If selection construct.
CONFIDENTIAL1 Good Afternoon! Today we will be learning about Review of Expressions, Variables, equations & Functions Let’s warm up : 1) Simplify: 4 x.
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
Honors Physics 28 Sept 09 Today: Intro to on-line text and acceleration Homework: Read section 2.2 p Text address: Tomorrow: We.
Algebra – Solving Systems of Linear Inequalities Objective: Students will solve systems of linear inequalities by graphing.
1 Lecture 15: Stability and Control III — Control Philosophy of control: closed loop with feedback Ad hoc control thoughts Controllability Three link robot.
Ultimatealgebra.com. WELCOME TO THIS CHAPTER 12 part 1 WE WOULD BE LEARNING ABOUT INEQUALITIES PLEASE MASTER THESE BEFORE YOU MOVE TO THE NEXT PART BECAUSE.
Gateway Quiz Reminders: The next Gateway will be given in class next week (check your course calendar.) Before then, each student who did not score 8/8.
ME451 Kinematics and Dynamics of Machine Systems Dynamics of Planar Systems December 9, 2010 Solving Index 3 DAEs using Newmark Method © Dan Negrut, 2010.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Chapter 4 MATLAB Programming MATLAB Troubleshooting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solving Quadratic Equations by Factoring
GCSE Additional Mathematics Information Seminar Tullylagan House Hotel 2 nd December 2009.
Physics 218 Alexei Safonov Lecture 3: Kinematics.
Scalars A scalar is anything that can be represented by a number (+ or -) and any associated units. A scalar is always written with a non-bold symbol and.
EEE 244-3: MATRICES AND EQUATION SOLVING
ECE 1304 Introduction to Electrical and Computer Engineering
Modeling and Simulation Dr. Mohammad Kilani
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
General recommendations
EEE 244-3: MATRICES AND EQUATION SOLVING
Presentation transcript:

IT1005 Lab session on week 11 (7 th meeting) 1 or 2 more weeks to go…

Lab 7 – Quick Check Have you all received my reply for lab 7? – Of course not. I have not finished grading your submissions yet >.< – I have important research paper deadline >.< Abstract due: 4 April 2008, Paper due: 8 April – My future reply should contains: Remarks on your M files (look for SH7 tags again) – For CSTR_input.m, CSTR_matrix.m, and CSTR_soln.m, etc Remarks on your Microsoft Word file – For the other stuffs Your marks is stored in the file “Marks.txt” inside the returned zip file! – I do not think I will be strict mode, the answers are standard for L7! Note that my marking scheme is slightly different from the standard one, as I put emphasize on coding style (indentation, white spaces), efficiency, things like proper plotting, etc…

L7.Q1 – 4 tanks CSTRs Q1. A. Transform the non standard set of Linear Equations into standard format: -(Q+k*V)*CA1 + 0*CA2 + 0*CA3 + 0*CA4 = -Q*CA0 Q*CA1 -(Q+k*V)*CA2 + 0*CA3 + 0*CA4 = 0 0*CA1 + Q*CA2 -(Q+k*V)*CA3 + 0*CA4 = 0 0*CA1 + 0*CA2 + Q*CA3 -(Q+k*V)*CA4 = 0 Q1. B. Convert the standard format into matrix format. Another straightforward task: [-(Q+k*V)000] *[CA1] = [-Q*CA0] [Q-(Q+k*V)00][CA2] [0] [0Q-(Q+k*V)0][CA3] [0] [00Q-(Q+k*V)][CA4] [0] Q1. C. You just need to do: V = 1; Q = 0.01; CA0 = 10; k = 0.01; A = [-(Q+k*V) 0 0 0; Q -(Q+k*V) 0 0; 0 Q -(Q+k*V) 0; 0 0 Q -(Q+k*V)]; b = [-Q*CA0; 0; 0; 0]; x = A\b % you should get x = [5; 2.5; 1.25; 0.625], x = inv(A) * b is NOT encouraged! % Using fsolve for this is also not encouraged!

L7.Q2 – n tanks CSTRs Q2. A. CSTR_input.m Answer is very generic, similar to read_input.m in L6.Q2 (Car Simulation) Q2. B. CSTR_matrix.m % This is my geek version, do NOT USE THIS VERSION (too confusing for novice)! function [A b] = CSTR_matrix(Q, CA0, V, k, N) A = diag(repmat(-(Q+k*V),1,N)) + diag(repmat(Q,1,N-1),-1); % This is a bit crazy :$ b = zeros(N,1); b(1) = -Q*CA0; Q2. C. CSTR_soln.m clear; clc; clf; % New trick, but important ! Clear everything before starting our program! [Q CA0 V k N] = CSTR_input(); [A b] = CSTR_matrix(Q, CA0, V, k, N); plot(A\b,'o'); % I prefer not to connect the plot with line, but it is ok if you do so. title('CA of each tank'); xlabel('Tank no k'); ylabel('CA_k'); % Good for CSTR_plot.m axis([0.5 N CA0]); % Fix y axis so that it is consistent across 4 plots (same CA0!)

L7.Q2 – Good Plot Should just stop here (n = 4) for case 1 Remember: Plot A against B means that A is the Y axis, B is the X axis!

L7.Q3 and Q4 Q3. Type these at command window: syms x y; % no need to say syms f1 f2, the next two lines will create f1 and f2 anyway f1 = x^2 * y^2 - 2*x - 1; f2 = x^2 - y^2 - 1; [a b] = solve(f1,f2); % or >> s = solve(f1,f2); a = s.x; b = s.y; eval(a), eval(b) % convert the symbolic values to numeric values, these are the roots Q4. Create this function function F = lab07d(x) F(1) = sin(x(1)) + x(2)^2 + log(x(3)) - 7; F(2) = 3*x(1) + 2^(x(2)) x(3)^3; F(3) = x(1) + x(2) + x(3) - 5; At command window (wild guesses will likely give you many imaginary numbers): [1 1 1])  x=0.5991, y=2.3959, z= [5 -1 1])  x = , y = , z= Tips for guessing logically: 1.Plot the functions with some range, see the region of zero intercepts… 2.Guess from the easiest equation! e.g. x + y + z = 5 3. log(z)… hm… z should be > 0

Application 5: IVP (revisited) Equation – A statement showing the equality of two expressions usually separated by left and right signs and joined by an equals sign. Differential Equation – A description of how something continuously changes over time. Ordinary Differential Equation – A relation that contains functions of only one independent variable, and one or more of its derivatives with respect to that variable. Initial Value Problem – An ODE together with specified value, called the initial condition, of the unknown function at a given point in the domain of the solution.

Application 5: IVP (revisited) We have seen several examples of IVP throughout IT1005 – Spidey Fall example (Lecture 2, Lecture ODE 1) How velocity v change over time dt? (dv/dt) – Depends on gravity minus drag! How displacement s change over time dt? (ds/dt) – Depends on the velocity at that time. The Initial Values for v and s at time 0  v(0) = 0; s(0) = 0; – Car accelerates up an incline example (Lab 6, Q2) How velocity v change over time dt? (dv/dt) – Depends on engine force on some kg car minus friction and gravity factor! How displacement s change over time dt? (ds/dt) – Depends on the velocity at that time. The Initial Values for v and s at time 0  v(0) = 0; s(0) = 0; – And two more for Term Assignment (Q2 and Q3)

Application 5: IVP (revisited) Solving IVP (either 1 ODE or set of coupled ODEs): – Hard way/Traditional way/Euler method: Time is chopped into delta_time, then starting from the initial values for each variable, simulate its changes over time using the specified differential equation! What Colin has shown in Lecture 2 for Spidey Fall is a kind of Euler method. What you have written for Lab 6 Question 2 (Car Simulation) is also Euler method. – Matlab IVP solvers: mostly numerical solutions for ODE. Create a derivative function to tell Matlab about how a variable change over time! function dydt = bla(t,y) % always have at least these two arguments % explain to Matlab how to derive dy/dt! Can be for coupled ODEs! dydt = dydt'; % always return a column vector! Call one of the ODE solver with certain time span and initial values [t, y] = [tStart tEnd], IVs); % IVs is a column vector for coupled ODEs! plot(t,y(:,1)); % we can immediately plot the results (also in column vector!)

Term Assignment – Admin This is 30% of your final IT1005 grade... Be very serious with it. – No plagiarism please! Even though you can ‘cross check’ your answers with your friends (we cannot prevent that), you must give a very strong ‘individual flavor’ in your answers! The grader will likely grade number per number, so he will be very curious if he see similar answers across many students. Do not compromise your 30%! – Who will grade our term assignment? I may not be the one doing the grading! Perhaps all the full time staff… dunno yet. – Submit your zip file (containing all files that you use to answer the questions) to IVLE “Term Assignment” folder! NOT to my Gmail! – Your zip file name should be: yyy-uxxxxxx.zip, NOT according to my style! – Strict deadline, Saturday, 5 April 08, 5pm That IVLE folder will auto close by Saturday, 5 April 08, 5.01pm Be careful with NETWORK CONGESTION around these final minutes… To avoid that problem, submit early, e.g. Friday, 4 April 08, night.

Term Assignment – Q1 Question 1: Trapezium rule for finding integration – A. Naïve one. Explain your results! – B. More accurate one. Explain your results! – References: help quad – Revision(s) to the question: Symbol ‘a’ changed to ‘c’ inside function f(t)! In Q1.B, the rows in column ‘c’ are [ ] not [ ]! In Q1.B, the range of k is changed from k = 2:n-1 to k = 1:n-1, but it is ok if you stick with the old one!

Term Assignment - Q2 Question 2: Zebra Population versus Lion Population – A. IVP, coupled, non-linear ODEs – B. Explain what you see in the graph of part A above. – C. Steady state issue. – D. IVP again, but change the IVs according to part C above. Comment! – E. IVP with different IVs, and different plotting method. Comment! – References: Google the term ‘predator prey’ as mentioned in the question. help odeXX (depends on the chosen solver) – Revision(s) to the question: No change so far…

Term Assignment – Q3 Question 3: Similar to Q2, Predator-Prey: n = 4 species – A. IVP again, 4 coupled, non-linear ODEs. Dr Saif said that we must use ode15s! (See ODE 3 & 4 lecture note) – B. IVP, same IVs, years, 3D plot x1-x2-x3 (x4 is not compulsory), and explain. – C. Explain plot in B as best as you can. – References: (mentioned in the question). Google ‘Matlab 3D plot’ help odeXX (depends on the chosen solver) – Revision(s) to the question: The ODE equations are updated! Read the newest one! The coefficient r(3) is changed from 1.53 to 1.43!

Free and Easy Time Now, you are free to explore Matlab to: – Do your Term Assignment (all q1, q2, and q3) – You should NOT use me as an oracle, e.g. I cannot find the bug in my program, can you help me? Are my 2-D/3-D plots correct? Are my …. bla bla … correct?