Modern MATLAB for Teaching Civil Engineering – 5 Things You Need to Know - MATLAB
Video Player is loading.
Current Time 0:00
Duration 1:20:46
Loaded: 0.20%
Stream Type LIVE
Remaining Time 1:20:46
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
  • en (Main), selected
    Video length is 1:20:46

    Modern MATLAB for Teaching Civil Engineering – 5 Things You Need to Know

    Hadi Khabbaz, School of Civil and Environmental Engineering, University of Technology Sydney

    Overview

    In this presentation we’ll present the new interface and workflows that makes MATLAB an easy and productive environment for teaching Civil Engineering concepts.  We’ll show a collection of features and workflows that reveal the usage choices that modern MATLAB provides – choices that span a “click and point” user experience, all the way through to the “interactive” document interface provided by the new LIVE editor.  Combined, these usage choices enhance the clarity with which engineering concepts can be presented in the classroom.

    At the end of this presentation, Associate Professor Hadi Khabbaz (from the University of Technology Sydney) will demonstrate how he has used the MATLAB app-designer and live editor for solving geotechnical engineering topics, particularly computing total settlement of foundations and the rate of settlement with time considering various conditions.

    About the Presenter

    Bradley Horton is a member of the Academic Customer Success team at MathWorks, helping faculty members better utilize MATLAB and Simulink for education and research. Bradley has supported and consulted for clients on projects in process control engineering, power systems simulation, military operations research, and earthquake impact modelling. Before joining MathWorks, Brad spent 5 years as a systems engineer with the Defense Science & Technology Organization (DSTO) working as an operations research analyst. Bradley holds a B.Eng. in Mechanical engineering and a B.Sc. in Applied mathematics.

    Hadi Khabbaz is the Deputy Head of School for Research and an Associate Professor in the School of Civil and Environmental Engineering, University of Technology Sydney (UTS). He received his PhD from the University of new South Wales. He has been involved in design of civil infrastructure and soil behavior modelling research for 25 years. His research has been focused on road and rail track foundations overlying soft soils, expansive soils, granular particles, closed landfill redevelopment and unsaturated porous media with strong applications to real life engineering problems. He was the Chair of Australian Geomechanics Society, Sydney Chapter in 2015-16. He developed many MATLAB applications for Geotechnical Engineering topics.

    Recorded: 19 May 2021

    Good afternoon, everyone and welcome to this session. My name is Bradley Horton. I'm one of the engineers that MathWorks. Today, I'd like to talk to you about a pretty specific topic and that is Modern MATLAB for teaching Civil Engineering. MATLAB has been around for a long time, 36 years in fact. And this longevity is testimonial of sorts to the benefits that MATLAB has brought to the engineering community. But longevity can be a curse too. We see a lot of teaching academics still using MATLAB releases that are over 10 years old, which is why we're talking today.

    Today I want to summarize 5 need to know things about modern MATLAB. I'll demonstrate them and show the benefit that it can bring to your classroom. I'm also thrilled to be joined today by Professor Hadi Khabbaz from the University of Technology Sydney. Hadi has been using MATLAB in his Geomechanics classes for over a decade. And he'll be giving a demonstration of some MATLAB tools that he's developed for some of his classes, specifically MATLAB applications for calculating the consolidation and rate of settlement of foundations on the axial loads.

    Now for a lot of people when you ask them the question, have you heard of MATLAB? It often conjures up a memory that looks something like this. A block of MATLAB code that does some computation. MATLAB syntax is being designed for solving matrix problems. And MATLAB is great for visualizing data too.

    When we visit Civil Engineering departments though and ask that same question, have you heard of MATLAB? We also get responses that sometimes look like this. I used MATLAB 20 years ago and didn't like it. MATLAB is a programming language and Civil Engineering students don't traditionally like programming. And MATLAB is difficult to use. And we also get responses that include I'm busy, Excel will suffice for my technical computations, my classes only require simple calculations, we use very specialized computer aided engineering packages, and learning can only be done with pen and paper.

    Now for that second block of responses, I think we can represent them by a single question. And that is, how does MATLAB enhance the learning experience for my students? And for the first block of questions, I think we can represent them by, is MATLAB still just a programming language, and has it changed much in the last 20 years?

    So let's start answering some of these high level questions. 20 years ago, we had Bill in the White House, president Zemun was developing the new economic reform model for China. Prime Minister, Obuchi was the leader of Japan, John Howard was the Australian prime minister, and Helen Clark defeated Jenny Shipley in the New Zealand Federal election. That's a long time ago, right.

    In 20 years ago, the MATLAB user experience looked something like this. You had this interface called the Command Window. And if you did not know what to type in, it was an extremely unfriendly experience. But if you did know a collection of valid commands, then MATLAB could do some incredibly powerful things in just a few lines. In addition to the command window, uses also typically had to write their own code using a text editor. You started with a blank page and you typed in your computations, usually in Carrie new font. You went back to the command window and asked MATLAB to run your computations. And often wonderful things would happen.

    Now, for some people this user experience was acceptable. But for a lot of people, it was a show stopper. It simply was not an interface that many people felt comfortable using. So the good news is it's not 1999 anymore. In 2021, the modern day version of MATLAB is so much more than just a programming language. The language is still there of course and as you and your students start to encounter more advanced design problems, you'll naturally gravitate to the language. But the big difference with a modern MATLAB is that you get to choose the user experience that suits you at that moment in time. And let me clarify that last statement by issuing a challenge.

    Imagine that you're a first year student, and you've just done a practical laboratory session. During the lab, you've collected some experimental data, let's say that data is stored in an Excel file. And now you need to process that data. And in this context, process means plotting the data and fitting a nonlinear equation to that measurement data. Let me show you how a first year student could use modern MATLAB to do all of this.

    This is the modern MATLAB desktop. To import our data we click on the Import Data icon and select our Excel data file. MATLAB's input wizard then goes away and automatically process that data, and then allows you to select the range of data and the output type that you would like to store the data in. Let's just import the data, say two simple column vectors. We then click on the green ticker icon to complete the data import process.

    We now have a column of x data and a column of y data. With these two columns of data in MATLAB, we can plot them. So we select the data and then we navigate to the plots tab sheep. We pick a plot type, say scatterplot, which for this data set is actually a poor choice. So we select another type of plot instead, say this semi log x plot, and this reveals the different scales represented by our data.

    And our next step is to perhaps annotate the plot. Let's give it a title an x label and turn on some grid lines. So the final task that we need to do is to now fit a non-linear equation to measurement data. And to do this, let's visit the Apps tab sheet and look for something useful. How about the curve fitting app? In the curve fitting app, we specify measurement data set; L x L y. And then we need a y to specify our specific parametric equation that we want to fit. And this custom equation option looks like it should do the trick.

    So we then type in our specific equation and boom, we've just fitted a nonlinear function to our measurement data set. And here are the values for the parameters of this fit along with the confidence bounce associated with them. So that ladies and gentlemen, is an example of modern MATLAB. Is it just a programming language? No, it's so much more than just that. Has MATLAB changed over the last 20 years? You better believe it has.

    For the remainder of this session, here's what we'll do. I'd like to call out five things that characterize modern MATLAB. Then I'll show you some specific Civil Engineering teaching demos using modern MATLAB. I'll then hand over to associate professor Hadi Khabbaz. And Hadi will show some of the MATLAB content that he's used in his Geomechanics classes. And finally, I'll wrap up with some comments on how to get the demos that you've seen today, as well as some suggestions on how we can support you if you're actually interested in adopting MATLAB.

    So let's talk about some of the attributes of modern MATLAB. And you know what? You've already seen two of them already. The user experience starts with the MATLAB desktop. And the desktop is broken up into panels, and these panels summarize where you are, what the data is that you're currently analyzing. There's also a tool strip at the very top of the desktop containing task tabs sheets. Each of these tab sheets give you access to icons for doing common tasks; things like importing data, accessing help, et cetera.

    If you need to plot data it says intuitive is going to the plots tab sheet and selecting a plot tab. So that's the Interactive MATLAB Desktop. Another one of the tab sheets on the MATLAB desktop is the Apps tab sheet. There are dozens and dozens of apps that allow students to focus and explore without being distracted initially by the need to write any code. For example, here is an app that allows students to explore different machine learning algorithms.

    Most of our apps also have the capability of automatically producing MATLAB code. So the benefit there is that once you've used the app to explore a concept for one data set, you can then apply that concept to dozens, hundreds, thousands of other data sets. And you do this by transitioning from an interactive workflow provided by the apps to a programmatic workflow. So the apps are a great way to start the analysis.

    The third thing that you need to know about modern MATLAB is the Live Editor. And for teaching and learning, this is a really big one. With the live editor, you can create interactive teaching documents that summarize and explain technical concepts. And then immediately beside that explanation, you have the computations that implement those same technical concepts. He is a MATLAB live script showing the characterization of a frequency response function produced from a steel truss.

    With the live editor you can embed user interface components directly into your scripts. And these interactive elements can make your scripts so much more engaging for your students. The live editor also allows you to hide the MATLAB code within your scripts, and this helps maintain focus on the conversation that you're having with your students. And when the time is right, you can then reveal the MATLAB code that implemented the concepts that you were just speaking to.

    The live editor can also be used to author algorithms. Here is what a MATLAB function looks like when authored with the live editor. And you can include as much or as little supporting commentary that you feel is appropriate. But you really do have an incredibly rich canvas for being able to link the explanation of an engineering concept to the computational implementation of that exact same concept.

    The fourth thing that you need to know about modern MATLAB is its vast library of technical functions, and just as important a Help browser that helps you find these functions and teaches you how to use them. You can access the Help browser directly from the MATLAB desktop. Just find and click on this Help icon, and it launches the Help browser. And here it is. The help browser acts as an electronic users guide. And you use it much like a typical web browser. You go to the search box, type in some keywords of interest, and the Help browser returns a whole bunch of hits corresponding to your search.

    So for example, he is a summary page that describes finding roots of nonlinear functions. The MATLAB function that actually does this task is called fzero. And here's the documentation page describing how to use the fzero function. What about solving ordinary differential equations? Yeah, just like we did before. We type in those keywords, and with a few clicks, we've found one of the functions in MATLAB that numerically solves ordinary differential equations.

    Now when you read these documentation pages, you'll find that they are littered with examples that demonstrate how to use that particular function. So the key takeaway is that with the MATLAB help browser, you and your students will have this constant companion that is always there ready to help when you need it.

    And finally, rounding out our top 5 things that you just need to know about modern MATLAB is a free self-paced online training course. It's called the MATLAB Onramp. To launch this free course, just go to your MATLAB desktop and click on the Learn MATLAB icon. And this will take you to a website where you can then immediately start doing the course. The MATLAB Onramp course takes about two hours to complete, and the course is delivered through your web browser. So you can log in and log out at your own pace and your own schedule.

    The course will teach you how to use the MATLAB desktop, as well as bring you up to speed on how to do some very common computational tasks. The material in the course is presented as static text notes and demonstration videos. But the big, big benefit of this course is that an Interactive MATLAB desktop is also provided in your web browser. So that after being introduced to a concept you get to practice that concept in your browser. And you'll get immediate feedback on whether you've done the practice tasks correctly or not. This free MATLAB Onramp training course is the perfect way for you and your students to learn how to use MATLAB.

    So that's the top 5 things about modern MATLAB. What I'd like to do next is look at some demos. To demonstrate modern MATLAB, I'm going to show a selection of examples on topics that you'd typically see in a four-year Civil Engineering undergraduate degree. We'll start simple and then progressively look at more complicated topics.

    The first case study is a really simple one and it's indicative of how to position MATLAB with early year students. In this example, will basically use MATLAB as a calculator and we'll also revisit that interactive desktop. We're going to explore whether a given retaining wall is stable or unstable. So let's go to MATLAB and check it out.

    He is a MATLAB live script that we'll use for our analysis of the retaining wall. Note that the live script allows you to provide formatted commentary to clarify the design task. In this example, we have a diagram and a summary of the relevant concepts. And as I scroll down the live script, you can see some examples of those interactive components embedded within the script. We've got Edit boxes to sign post parameters that we want to assign values to. And the dropbox allows us to choose from two specific soil types.

    And as I interact with these components, the calculations are being done behind the scenes. Now right now you can't see the computations that are being performed. But when you do decide to reveal those calculations, we just toggle one of the display modes of the editor. And here are the MATLAB commands for producing the simple calculations.

    Now let's look at another scenario that might be relevant to that early year student. We're telling them that we have some laboratory data on wall height versus overturning moment. And we want to use that measurement data to compare the computed soil coefficient against the value in the handbook. Now to perform this task, we just get them to utilize the MATLAB desktop. So let's import the measurement data. Here is the import wizard that we saw before. We've now got our columns of wall height and moment.

    And to characterize this relationship, let's open up the curve fitting app. We specify the data that we want to use. Will specify our parametric equation. And here's the model parameter. A soil coefficient of about 0.22. OK. So that's what MATLAB usage could look like for an early first-year student. We want to give them a technical computing environment that is really easy to use.

    The next case study that I want to share with you is more attuned towards that second year student. We'll look at a design task associated with open channel flow. Our analysis for this problem will involve defining formulas, visualizing formulas, and solving roots of nonlinear functions. I'm also going to show you another example of how the live editor allows you to perform computations without coding. We can actually embed many apps directly into the script. And we'll use this workflow to solve a constrained optimization problem.

    OK. Let's go back to MATLAB and check it out. Here's the live script that we'll use for this analysis. We've got a rectangular shaped channel. We know its flow rate and its width, and we need to determine the depth of the channel. We're going to use Manning's flow equation to solve this design problem. And he is how you define a formula in MATLAB. This is Manning's discharge formula parameterized by its coefficients and the geometry of the section.

    For this design task, will also define another formula for the flow rate. And here the flow rate is only parameterized by its depth. And we can now use this formula to compute the flow rate for a list of depth values. And these computations can nicely be summarized in a table. To solve our design problem, let's just plot the flow rate formula.

    The red line represents our target flow rate. So if I just zoom in on where the two curves intersect, this tells us that a depth of about 0.73 meters delivers our target flow rate of 2.83 meters cubed per second. Now this graphical technique for solving the design task is nice. But let's look at an alternate approach. We'll define a new formula that combines our target flow rate with Manning's discharge equation. So our design task can now be solved by finding the roots of this new non-linear equation.

    Let me pull up the Help browser and we'll look again at the function in MATLAB that does this. Here is the duck page for the fzero function. And the dock page describes the calling syntax for this function. It tells you what the inputs need to be and what the outputs of the function will be. And remember the documentation page also contains examples that demonstrate how to use this particular function.

    Let me run these computations. We see that the fzero function has computed a result of 0.73 meters, which is the same depth result that we determined earlier throughout graphical visualization. Before we finish up with this open channel flow example, I'd like to show you a few extra credit topics. One is about visualization and the other is on optimization.

    For a rectangular channel characterized by a depth D and a width B, he is what Manning's equation looks like. Let's plot this equation and observe the shape of the surface that it produces. The second plot on the right hand side shows the surface contour corresponding to a discharge rate of 2.83 meters cubed per second. And these visualizations are giving your students some insights into how the geometry variables impact the flow rate.

    If we focus on the control plot for a moment, we know that each one of these little red dots gives us our required target flow rate. And each one of these little red dots has a certain monetary cost if we had to excavate this channel out of the ground. Now as an academic exercise, let's say that this excavation cost is represented by this simple Pythagoras's rule. When I plot this cost function, we can again visually determine the optimal geometry values that minimize the excavation cost and deliver the design flow rate.

    So in this instance when I zoom in on this plot, we see that the optimally shaped rectangular channel has a width of about 1.83 meters and a depth of about 1.74 meters. And this is the optimal design for this target flow rate. So what we're talking about here is looking for an optimal engineering design. If we can formulate an appropriate cost function, then the design problem becomes one of solving an optimization problem.

    In MATLAB there's a function that allows you to define and solve constrained optimization problems. It's called fmincon. Let me bring up the doc page. To use this fmincon function, you specify your cost function and your problems constraints, and then it finds the design vector that minimizes your specified cost. So in our script, we start out defining all of the inputs that we need to supply to the fmincon function. Things like the upper and lower bounds on our design variables, what our cost function is.

    And with all of these pieces defined, we can then just invoke fmincon to solve our specific problem. But there is an alternate way of solving this optimization problem. Rather than writing out our computations in code form, we can instead insert one of these mini apps into the script and configure the optimization problem through its graphical interface.

    The graphical interface walks you through each step of setting up the optimization problem. What kind of cost function do you have, what kind of constraints does your problem have, in these configuration choices then recommend the solver that you should use, which in this case is fmincon. And then you specify the MATLAB variables that represent these configuration choices. Let me run this task.

    And for this rectangular section design problem, we get an answer similar to the one that we saw when looking at the contour plot. Clearly, the value of formulating an optimization problem, though, is that it can solve problems that have dozens, hundreds, thousands of design variables. OK. So I hope you enjoyed that walk through. We looked at this open channel design problem from three or four different perspectives. And in the process, got to see just a little bit more of what modern MATLAB is all about. Let's go back to PowerPoint and I'll introduce our next case study.

    The next case study that I want to share with you is from the Soil Mechanics application area. And we see these topics being taught in that second to third year time frame of an undergraduate degree. We'll look at a MATLAB implementation of a common algorithm that characterizes the stability of a slope. Our engineering design task is to compute the factor of safety. Our analysis for this problem will involve centralizing the design task in a live script, developing and implementing the algorithm in a live function, and utilizing MATLAB's plotting and visualization capabilities as a way to confirm the intermediate steps involved in solving this problem. OK. Let's go back to MATLAB and check it out.

    Here's the live script that we'll use for our slope stability analysis. We're going to use Bishop's Rigorous technique for computing the factor of safety. This particular algorithm involves dispartizing the cross section into a series of panels. We compute a number of attributes for these panels. And then we need to solve an implicit equation for the safety factor f.

    Our first few steps involve defining our value circle and the slope profile, and also the number of panels that we want to divide the cross section into. Here, I'm using an interactive slider bar, to really signpost that the number of panels is something that our algorithm allows us to vary. For each one of these panels, we then need to compute a collection of properties. Things like the centroid of each panel, the panel area, and so forth. The table that's being displayed on screen right now summarizes these properties for each panel. The calculations represented by this table were computed in a custom function. Let me show you what algorithm authoring looks like with modern MATLAB.

    Here, we're looking at a function authored with the live editor. The benefit of the live editor is that you can incorporate as much or as little supporting commentary that your algorithm requires. As I scroll through this function, you can see the diagrams and formulas are placed right beside the MATLAB code that implements those computations. And like any computational task with MATLAB, we're able to take full advantage of MATLAB's existing library of functions.

    For example, for this part of our algorithm we're going to utilize the polyshape, centroid, and area functions. And these are all critical to what we want to do, but you wouldn't want to write them yourself, and you don't have to. Let's go back now to our main design script. For each of these panels, we also need to determine the weight force and the normal and tangential components of these weight forces. We've written another one of those custom functions to do those calculations, and the results are again being summarized in tabular form.

    So all of the pieces needed to compute Bishop's formula are now in place. From here, I'd like to show you two approaches for computing the factor of safety. One is graphical, and one involves finding the roots of a non-linear function. Let's start with the graphical technique. With this approach, we first need to implement the right hand side of Bishop's formula. So we'll create another live function to do this. Here is the life function for computing Bishop's formula. Lots of diagrams, lots of annotations. And when we need to clarify a computational step, we insert a richly formatted description right beside the MATLAB command that is doing the computation.

    Now, factor of safety can now be determined by simply plotting this Bishop's formula, and looking for the point of intersection with the straight line of gradient 1. Let me run the section and we'll look at the resulting plot. As I zoom in, it looks like the factor of safety f is around 1.37.

    Now, an alternate way of computing this safety factor is to define a new function and to then compute the root of this new function. This can be done very easily using fzero. When I run these computations, I again get a factor of safety of around 1.37 very similar to what we saw in the graphical technique. So the main takeaway from this design case study is this; when you want your students to develop, implement, and utilize algorithms for solving engineering design problems, the live editor is such a powerful tool for enabling this.

    OK, let's head back to PowerPoint for our next case study. In Civil Engineering classes that teach structural analysis using the finite element technique, we often encounter the Goldilocks syndrome. And what I mean by that is that once the theory of the FEA technique is introduced, students are then usually given small scale problems to solve with pen and paper, and that all makes sense. But then often something really strange happens. A commercial grade FEA package gets introduced. And the rationale is that these are the sorts of packages that the students will be using once they graduate. And again that bit makes sense. But what makes it a little bit strange is that often, the middle sized problems, the problems around the tens to hundreds of degrees of freedom. These get absorbed into the commercial FEA packages. And as a result, a lot of insights and lessons into how the FEA technique works, these learning benefits sometimes get lost.

    The great news though, is that these middle sized problems are perfect for MATLAB. So the next example that I'd like to share with you is one where we're using MATLAB to explore and solve these middle-sized finite element problems, specifically a structural deflection problem. The live script will again be used to solve this problem. MATLAB was built to solve matrix problems. So if you're looking for a simple to use matrix calculator, MATLAB is it. And lastly, in this example, I want you to keep your eye out for the twist at the end of the story. OK. Let's go to MATLAB.

    This is a MATLAB live script that we're going to use to implement the stiffness method to solve for the deflection of this specific steel frame. At the bottom of the script, we have all of the implementation details of the algorithm. Here is a sub function that defines the local element stiffness matrix. We've also got an appendix in the script that describes the coordinate transformation process for converting local elements stiffness into their corresponding global sicknesses. And immediately below this commentary, we have a MATLAB sub function that implements these very concepts.

    Here's the part of the script that walks through the assembly process of the global stiffness matrix by processing one element at a time. Let me run the script so that you can see our stiffness matrix. This heat map displays the global stiffness matrix. And as expected, it's extremely sparse. We have 12 degrees of freedom before we apply the boundary conditions.

    In the next part of the script summarizes how to apply the system boundary conditions. And this is all about partitioning matrices into sub matrices and then solving a system of linear equations. And MATLAB is very good at doing that. Here's the MATLAB code that implements the application of these system boundary conditions.

    Finally, he has a table that summarizes the displacements at nodes 2 and 3 along with the reaction forces and moments at nodes 1 in 4. In this example, we only had three elements, but the workflow that we've just reviewed can very quickly be extended for final mesh discretizations. Here's a script where we solve exactly the same problem but we use 30 elements instead of 3. We use a simple for loop to automate the assembly of the global stiffness matrix. And for this problem, our global stiffness matrix is a 93 by 93 matrix. The MATLAB commands for solving this problem are identical to the previous example. A stock standard application of MATLAB's famous backslash operator.

    And here are the tabulated results for the node displacements. So there you have it, an example clearly too big for pen and paper. By implementing this in MATLAB, students can get close enough to the details of the final element technique without any concern about the size of the matrices being manipulated.

    And one more thing; while you're stirring at the screen right now, do you see anything unusual about the MATLAB desktop that we've just been using? We've actually been running the steel frame example inside MATLAB Online. MATLAB Online is the version of MATLAB that can be launched inside your web browser. One of the big benefits of MATLAB Online is that you don't need to install any software onto your computer. Provided you have an internet connection and are associated with a MATLAB license, well you can just launch and use MATLAB Online directly from your web browser, and it looks and feels just like the desktop version.

    OK. The last example from me today is a really quick look at one of those classic structural dynamics problems that many civil engineers are asked to analyze. We'll look at the simulation and modal analysis of discrete math systems. And these are the types of models often used for studying the dynamic response of buildings during earthquake events. The main takeaway from this example is that the numeric solution of systems of ordinary differential equations is incredibly simple with MATLAB. Let's go to MATLAB and check it out.

    Here's the live script that we'll use to analyze this 2-DOF discrete mass system. We start the analysis by drawing our free body diagrams and then writing out Newton's Second Law for each mass. And this gives us two coupled ordinary differential equations. These equations of motion are characterized by the mass, damping, and stiffness matrices. And we can define these matrices using the numeric values for our specific problem.

    To numerically solve our two ordinary differential equations, we need to define our system initial conditions. And we also need to define the external excitation forces that are applied to the two masses. In this example, we'll define 2-step functions acting on our masses. To numerically solve this dynamic system, we're going to use one of MATLAB's ODE solvers. And the ode45 solver is a good general-purpose solver.

    Let me bring up the documentation page for this function. The doc page summarizes the calling syntax and it tells you that you need to package your system of ODEs into a first order form. A common way to achieve this for linear systems is this particular state space formulation. And writing a short live function is a really easy way of implementing this. Let me show you.

    Here's a live function that assembles our system of ODEs into a first order form. Note the rich commentary and the really compact MATLAB syntax that implements the computations. So once our system is in this first order form, we just invoke MATLAB ODE solver and it numerically solves our ordinary differential equations. We can then extract and plot the states of the system. So that in a nutshell is how to use MATLAB ODE solvers.

    And lastly, folks that are interested in Structural Dynamics are also usually interested in Modal Analysis. And Modal Analysis means solving an eigen value problem. And MATLAB was built to solve matrix algebra problems, which means you have this nice compact syntax that looks very similar to how you write these expressions out with pen and paper. OK. So that folks is a sneak peek of what modern MATLAB has to offer. Let me go back to PowerPoint and I'll summarize what we've just done, and then I'll hand over to associate professor Hadi Khabbaz.

    When someone asks you, have you heard of MATLAB? Then I'm hoping what comes to mind now is that modern MATLAB is an environment for doing technical computing. It gives you an interactive desktop. It gives you apps, a documentation system, a library of thousands of ready to use algorithms, and of course, a syntax that specializes in solving engineering problems. And a real benefit of this modern MATLAB is that it gives you and your students choices on how you want to do your technical computing. You can leverage the interactive desktop and then at your pace, evolve to using scripts, and then eventually authoring functions.

    OK. One last thing before handing over to Hadi. The demos that we've been looking at over the last 45 minutes are part of a hands on workshop that we've made specifically for Civil Engineering. Each of the case studies has a partially completed solution that you can ask your students to work on. And of course, there's also the full solution for each exercise. If you'd like to get a copy of this workshop, I'll give you details on that at the end of today's presentation.

    OK. Our next speaker today is Associate Professor Hadi Khabbaz from the University of Technology Sydney. Hadi, Thanks so much for your time today. When it comes to teaching Geomechanics, can you tell us a little bit about what you've been using MATLAB for in your classes?

    Hello MATLAB buddies. Hello, friends. Today, I would like to talk to you regarding using MATLAB as an effective tool for Civil Engineering Education. I will put emphasis on Soil Mechanics, particularly soil consolidation. My name is Hadi. And you can contact me if you need more information.

    That would be the outline for this short video. Soil mechanics with MATLAB, Soil Consolation, a tool, let's call it Geo-buddy Tool, and explaining why MATLAB is an effective tool for education in Civil Engineering, and some concluding remarks. OK. As we have different mechanics; Solid mechanics, Fluid mechanics, then we have Soil mechanics as well. Soil mechanics is a combination of Solid mechanics and Fluid mechanics. It might be more complicated. But don't worry, we make it easy for geo-buddies.

    This is part. It's Civil Engineering first step, called statics. A simply supported beam with a uniformly distributed load. Two simple questions, how do you calculate the reaction force it supports, and how do you calculate the maximum bending moment? All right. We can write a simple MATLAB program, a code and then because they are very, very basic, my calculations is very, very simple and the results 2 answers for the reaction and the maximum moment. I'm plotting the results. So look at that answer here. But we prefer to write it in a graphical user interface. You would like to just press a button, one button and get the answer. If you need to change input data, easily you can change. And then you can have your results and graphs. But let's using an app design.

    Let's go to MATLAB. OK. That's the app designer. So already just opened app designer. Let's go for the design view. So simply you can write axis, buttons, or maybe edit feet numeric, put in two different panels inputs and outputs and reserves a place for bending moment diagram. Firstly, I put a push button here. Press this button to see beam general components. And then another button for Run and Close. OK.

    The view code, very, very simple. So for each button, especially for the Run, so we are writing a few simple calculation. Very, very easy. Just follow the instructions and you can find your inputs and then coming to outputs, A, B, C, W inputs some calculation and then to results, and plotting the results. OK. This is a push button for Close and this is a push button to show the channel. Let me just run it. You can see. OK. That's the app.

    First, let's press this button. From here to here, a, b, and c metres. You have some load here, uniformly load distributed. But can see, we can start a 0, or c 0, so it can be fully loaded and reactions. Now, come back and run. Now we can see the answer. If I make it 0, and this one also 0 and run, we can see it is fully loaded. You put here another number 3 meters, here 1 meter and run so you can see it's curved. And we have the maximum moment and also reactions. Very easy to use app design. Let me just close this one and come back to my PowerPoint presentation.

    All right. I wrote many programs, as small codes using live editor for teaching Soil Mechanics. I'd go through it one by one later. But today I put emphasis for consolidation and Rate of Settlement. As for Soil Mechanics, we start with phase relationships. So mostly talking about air phase, water phase, and soil cranes. And then we are coming to many, many relationships; void ratio, porosity, degree of saturation, so on and so forth.

    So classification is very important. So easily we can make a program and then based on the standard, we have to make sure the name of soil is gravel, sand, silt, clay. Or come into different classification of names and symbols. Now coming to compaction, which is very, very important for roads and for infrastructure, and we have the formulas and the standard compaction and all sorts of things. Effective stress in Soil, which is very important. Again, we just modeled in MATLAB.

    Seepage using Darcy's, so it's a one dimensional lots of equations and assumptions, and you can find and answer for the flow rate or permeability of soil. Dewatering while using Darcy's law in a different way and come up with the calculations for the aquifers and pumping permeability of the ground. We are using Flow Net as a 2D or sometimes it can be 3D. But make it simple 2D in Soil Mechanics. The Flow Net equal potential lines and flow lines and coming down.

    We'll look at also the effective stress and finding the critical condition and quick condition to finding what's the stress. If it is less than 0, we have liquefaction. Shear Strength of soil either cohesionless sandy soil or coming to cohesive soils, clay soils. And you have the equations and formulas for different approaches, different situation. But let's come to consolidation.

    Thanks to the founder of modern Geo-technology, Karl Terzaghi. He just gave us a consolidation equation. For the general and total consolidation, the formula is not complicated at all for finding the void ratio. The changing in void ratio, we have to do something. So we are finding here. Let me just check the time. OK. Now, coming to some pre-consolidation concept normally and over-consolidated concept and total final settlement, how we can find and these equations easily can be implemented in MATLAB.

    All right. Summations Soil mechanics in MATLAB consolidation rate of settlement because sometimes you would like to know after one year, how much of settlement happen. Sometimes maybe it's very fast. Maybe after six months. So total excess pore pressure is dissipated. Total dissipated. But sometimes, it takes time. And that's called rate of settlement. And Terzaghi came up with a partial differential equation. And he came up with a solution as well, but he knew many engineers cannot use this one easily just using that series. he came up with the concept of Cv as a time factor for consolidation. And definition of Cv hard to find in the lab, and provide the charts and also tables and some people convert it to based on fitting some equations.

    All right. Let's go for consolidation. Consolidation the main assumption is your soil is saturated. It means your expanding water out of soil. Not air. If the air is out, it's called compaction, which is very quick. Consolidation takes time. For many assumptions by Terzaghi, the clay layer is homogeneous, the clay layer is saturated. And Darcy's law also valid, because there is a laminar flow and he mentioned the confusion of consolidation as constant during the consolidation. That's Cv. Definition of Cv is based on permeability, unit weight of water, and the Mv, this is the volume change rate, or coefficient of volume compensate.

    Well, many jargons in consolidation I collected them here, for example, what is OCR? Over Consolidation Ratio, it depends on consolidation pressure and initial effective stress. OK. Add to that equation partial differential equation. And we have some maybe figures, graphs, and other things. All do we need. So at any time. So why not using Finite Difference Method, Finite element? A difference for students undergraduate easily possible is very, very easy.

    So the concept, for the first derivative, instead of writing df over dx, they're just coming to the difference between f values divided by delta x. h we it here h, which is delta x. It can be forward difference, backward difference, or central difference. Usually for a time, we are using backward difference. Otherwise, so it's very quick to use central difference because it's very, very stable.

    For the second derivative, especially for the 2D, so we are using that situation. , Oh this is for 1D for x here. So easily can be used. So again, forward difference, and then backward difference and central difference unconditionally stable. That's the formula 1-D Consolidation Equation. And here, I am using U xs as the excess Pore Water Pressure. And that's the solution by Terzghi based on different boundary conditions and definition of the time factor. All right. And he provided charts and graphs and tables, people they can use it. Example. For example, coming for the 50%, it gives us that.

    But now, let's convert it to very simple equation based on Finite Difference Method. So this part on the left hand side, can be converted to this equation here. And coming to the right hand side because it's parallel too, am using this equation. All right, Cv should be given to us. So that's the governing equation and that would be the solution. But try to make it very easy. We are looking for the pore pressure at the time t plus detla t. Based on for pore pressure at different times for one step before, t, t and t.

    But based on three points maybe coming from the top to the bottom, negative 1 and 0 and plus 1. So it means based on these three, we can find that point, the pore pressure. But I need delta t, delta z and Cv. You can just break down your time, and break down your height of clay layer. Because for time, we are using actual difference, it should be stable using that formula. And to make it a stable, m should be less than 0.5. And then that's the formula. This one, substitute as an m. If for example, m is 1/3, that formula will be very easy. Average of three points the time before coming to time after t plus delta t.

    That's the MATLAB code for this simple program. As you see, we're using a loop and calculating for the entire system. That's all. Very, very easy and straightforward. I put many programs as I want to. Let's call it Geo-Buddies Tool. And we have Soil Mechanics tool. Geotechnical Engineering, Applied Geo-techniques. And we have many, many other things. Lecture slides can be there. Cool Stuff of some photo gallery.

    Let me just quickly go to MATLAB and run Geo-Buddy too. That's the Geo-Buddy Tool. It has got another thing. So connected to this one again is a text based graphical user interface. That's Geo-Buddy Tool and run. Now we have that tool here. So as I mentioned, you have a lecture slides and you have different programs. But let's go for Learning Soil Mechanics using Live Editor Files. OK. And then come to consolidation.

    All right. Now you have consolidation in Live Editor. So in Live Editor also, it's very easy. I can use my slides and calculations and mix them together. Very, very easy to use. So look at here, that's the definition of settlement and the equation, and pre-consolidation and definition of normally consolidated. Total finite saturation. And put an example at the code. So easily, we can run this one and get the all the answers is here. We can come up with total settlement is 124.1 millimeters.

    Let me just go back to Geo-Buddy Tool. So let me just close this one. Then come to-- OK. Quality. Go to live editors and come to Rate of Settlement. Now you can see the rate of settlement is very again similar. Some explanation on time and then writing the equation, explain the equation, and coming to an example. This is a simple example. We have sand and below we have clay and we would like to calculate the rate of settlement based on the required time. As for consolidation especially for the rate, you have to look at it is a one way or two way drainage path. For example, that clay depends on the bedrock here. Is it permeable or not permeable. Can be two way, or one way. And we can calculate both of them simultaneously. And this one again, and gives us the answer here. You can see all the answers.

    It gives us the settlement of clay layer, and time for 99.95 for total settlement and many other things can be calculated for one way or two way drainage system. Easily, you can change your values and get the new answer. Now, I just put these sort of things in one file is called consolidation file. Again, it's a graphical user interface. You can use either App Designer, which is recommended. It's easy, or just writing by yourself as a text based GUI, Graphical User Interface. Or just some notes we have a saturated clay and on the bedrock, but the underling the sand layer, sand is on the top as a one way consolidation.

    Let's run and you can see the results. The clay layer is over consolidated. You know that definition in Soil Mechanics and the total settlement. Now coming with the drainage, I'll requested that it should be after 100 days. 100 days, we have the consolidation. Degree of consolidation is 58.6%. For two way, it's much faster as expected. And we know the settlement for this ones. You can change other parameters and you can get the results. And also you have the graph, you can see you are reaching to the total final settlement.

    But as for clay, especially for soft clay, we have secondary compression as well. We call it creep settlement. So you look at here, years after completion of primary consolidation and put as an input, 16 inputs. And we can find the creep settlement as well. So in one goal, we have the primary consolidation, secondary consolidation and rate of settlement. For example, if you change load, you can increase or decrease your settlement. All the time, so for example, we have 100 days, make it 50 and run. Now you have the new results. And the coefficient of consolidation can be less or more. Make it more and run. It can be faster. And all of them for editable. So let me just close and so look at here.

    So easily, we can put the inputs and run the program. OK. Now is a good time to go back to our-- One more thing I would like to show before coming back to my PowerPoint and come to some conclusion. All right. The other one is, OK. Coming to again, Geo-Buddy tool and running, you have a pore water pressure using finite difference method as well. Very similar calculating consolidation ratio using Finite Difference Method, thickness of place given, time required for calculation is given, and many others. Let's run, and you can see the animation using this pause command. Based on the time, so dissipating the two-way drainage system.

    At the end of 24 months, I have the results in the table from the top to the bottom of the clay layer. And then we are checking here the condition. The condition is OK, it should be less than half since less than half degree of consolidation right here. Now make it one way and run. OK, you can see very similar. But only from the top you have a drainage system, not from the bottom.

    If you would like to be faster, you can put a different pause. And that would be your distribution and it is also here. OK. Let's close it. Close this one as well. And then come back to my PowerPoint presentation for some conclusion. OK. civil engineers are analytical and logical seeking for optimal solution technically or creative and problem solved, but they need some additional skills, like leadership and teamwork. But in my view decision making is very, very important for civil engineers and geo-buddies.

    So MATLAB can be employed in Civil Engineering Education and design problems to helping you for the decision making aspect. Why? Because easy metrics operation, powerful graphics, and graphical user interface. You can use live editor, you can use App Designer, GUI, and useful tool boxes. Now my take-home message to you MATLAB buddies. In Civil Engineering, what to do is important than how to do. How to do, how to design the pipes, how to find the settlement, there are some equations and conditions and other things. So we can give it to MATLAB to do it. But making a decision which model you have to use. So which area you have to construct, that's what to do. And MATLAB can facilitate this aspiration to help you how to do, and then you have enough time to make your decision. OK. Thank you very much for your attention. Have a good day. Bye.

    Thanks, Hadi. That was absolutely incredible. I really like the blend of using custom made apps along with the live scripts. That seem to be yet another example of how there are choices in the way that MATLAB can be used just fantastic. OK. If you're curious about trying some of this in your own classes, the next big question has to be this one. How do you get started when perhaps you haven't really used MATLAB before or if you did it was a long, long time ago. Well, let me offer 4 suggestions.

    My number one suggestion has to be the MATLAB help browser. Built directly into the MATLAB desktop is this help icon. When you click it, it launches the MATLAB web browser. And the browser is a blend of a digital users guide and a web browser. You can use it to search for information on how to do specific things, for example, here is a Getting Started with MATLAB page. Here you can access tutorials on how to use MATLAB, as well as access thousands of examples that ship with MATLAB. The help browser really is an extremely helpful resource if you want to learn how to use MATLAB.

    My second tip for getting started is our library of self-paced online training courses. The courses are presented through your web browser. So you can log in, do 30 minutes then come back tomorrow and pick up where you left off. These courses don't just deliver static text and videos, but they also provide a built in desktop into the browser where you get to apply and practice the concepts that are being taught in the videos. I'd recommend the MATLAB Onramp as well as two or three of our courses from the Computational Math Series. The solving ODEs and solving nonlinear equations to such courses.

    My third suggestion is to check out our online teaching with MATLAB website. This site contains resources to help you ramp up on all of our new tools that have been developed specifically for teaching. For example, if you have never used the live editor before, you'll find a quick 20 minute video explaining how to use it to make engaging documents for your class. And my final suggestion on getting started is to speak with one of our customer success engineers. Our customer success team can support you in developing new curriculum for your class. They can run hands on workshops for you and your support team, such as the post grads who are tutoring your classes. And the work that these customer success engineers do is absolutely free.

    So that brings me to the end of this presentation. And an offer that I'd like to leave you with is this. If you're interested in getting the Civil Engineering workshop case studies that we demonstrated today, then send a query to this email address and request to speak with one of our customer success engineers. One of our engineers will call you and speak to you about the classes that you're teaching, and discuss some concrete ways that they can support you. Thank you everybody. Thank you for your time today.