Example False position Method Problem in MATLAB Live Script
Summary
Interactive MATLAB activity to implement and analyze the False Position Method (Regula Falsi) for finding roots of nonlinear equations. Includes theoretical introduction, step-by-step graphical visualization, selection of initial bounds, iterative root calculation, relative error estimation, and stopping criteria. Designed for both teaching and self-study, with section-by-section execution to enhance understanding.
Learning Goals
From this activity, students will be able to:
Understand the theory and algorithmic steps of the False Position Method (Regula Falsi) for root finding.
Identify the conditions under which the method is applicable (sign change in the interval, continuity of the function).
Apply the method iteratively to approximate a root within a desired error tolerance.
Interpret and analyze convergence behavior by examining iteration tables and graphical output.
Use of MATLAB:
Students will be able to use MATLAB to define and evaluate functions, implement iterative algorithms using while loops, and generate plots to visualize the process.
The Live Script structure allows for step-by-step execution and immediate visualization of results, enhancing comprehension by connecting mathematical theory with computational implementation.
This integration helps bridge the gap between manual calculations and automated computation, reinforcing both programming skills and numerical analysis concepts.
Higher-order thinking skills developed:
Critical thinking: Selecting appropriate initial bounds and interpreting why certain intervals fail to meet the sign-change criterion.
Computational reasoning: Translating mathematical formulas into executable MATLAB code.
Data analysis: Examining output tables and error progression to assess convergence.
Synthesis of ideas: Comparing the False Position Method with other root-finding methods, identifying strengths and limitations.
Other skills developed:
Technical communication: Documenting code with comments and presenting results clearly in tables and plots.
Problem-solving collaboration: Working in pairs or small groups to test variations and discuss outcomes.
Self-directed learning: Modifying parameters and experimenting with different functions to deepen understanding.
Context for Use
This activity is designed for undergraduate engineering students enrolled in Numerical Methods, Mechanical Engineering, Materials Science, or related courses. It is suitable for class sizes of approximately 15–30 students in a university setting. The activity is typically conducted as a classroom-based interactive session or as a guided lab exercise, and it requires approximately 45–60 minutes to complete, depending on the depth of discussion and experimentation.
Students should have basic MATLAB skills before starting, including:
Creating and using anonymous functions (function_handle).
Writing and executing MATLAB scripts.
Using basic plotting commands (plot, xlabel, ylabel, grid).
Understanding logical operations and if/else statements.
From a disciplinary perspective, students should already be familiar with:
The concept of a mathematical root and sign change in an interval.
Fundamental principles of bracketing methods for root finding.
The difference between absolute and relative error.
This activity fits naturally after introducing root-finding concepts such as the Bisection Method and before more advanced open methods like Newton–Raphson. It is easy to adapt to other STEM disciplines where solving nonlinear equations is relevant, such as Physics, Computer Science, and Applied Mathematics. The Live Script format and section-by-section execution make it flexible for both face-to-face and online teaching, as well as for self-paced learning assignments.
Description and Teaching Materials
This activity is designed as an interactive MATLAB Live Script that guides students through the False Position Method (Regula Falsi) for finding roots of nonlinear equations. The Live Script contains:
Introductory theory explaining the mathematical basis of the method.
Step-by-step code sections for defining the function, selecting initial bounds, calculating the root iteratively, and evaluating the error until convergence.
Graphical visualizations to illustrate the position of the lower bound, upper bound, and the computed root at each step.
A fully implemented MATLAB function (FalsaPosicion) that can be reused with different functions and parameters.
Mechanics of the activity:
The instructor introduces the method conceptually and shows the Live Script in Output Inline mode in MATLAB.
The class runs the code section-by-section using "Run Section" or "Run and Advance," observing how each step affects the computation.
Students modify parameters (xl, xu, tolerance) to see how these changes influence convergence speed and accuracy.
The activity ends with a discussion comparing the method to other root-finding algorithms such as Bisection or Newton–Raphson.
Required materials:
Primary file: Falsa_Posicion.mlx – MATLAB Live Script containing theory, code, and instructions.
MATLAB software: R2020b or later (earlier versions may work but are not tested). No additional toolboxes are required.
Instructor handout (optional): A brief guide on initial parameter selection and common convergence pitfalls.
Internet connection (optional): For accessing MATLAB documentation or sharing via MATLAB Grader.
MATLAB usage and justification:
The activity uses MATLAB for:
Function definition and evaluation.
Iterative computation using loops and conditional statements.
Generating plots for visual understanding of the convergence process.
While other software (Python, Octave) could be used for similar implementations, MATLAB was chosen because:
It is widely used in engineering courses at the undergraduate level.
It offers an intuitive Live Script environment combining narrative text, code, and output in one document.
It integrates seamlessly with MATLAB Grader for online assignments and automated assessment.
Availability of materials:
Main activity file hosted at: [GitHub Repository URL or MathWorks File Exchange URL] (replace with actual link).
The Live Script format (.mlx) is editable for faculty wishing to adapt the activity, and a PDF version can be provided for students who only need to follow the narrative without modifying the code.
File descriptions:
Falsa_Posicion.mlx – Interactive MATLAB Live Script for the activity (fully editable).
Example False position Method Problem in MATLAB Live Script (MATLAB Live Script 72kB Nov6 25)
Teaching Notes and Tips
Start with a conceptual overview: Before running the Live Script, briefly review the theory behind the False Position Method, emphasizing the requirement of a sign change in the interval and the difference from the Bisection Method.
Demonstrate MATLAB basics if needed: For students with limited MATLAB experience, ensure they know how to:
Open and navigate a Live Script.
Switch to Output Inline mode.
Use Run Section or Run and Advance to execute code step-by-step.
Encourage interactive parameter changes: Ask students to modify xl, xu, and the error tolerance Es to see how convergence behavior changes. This reinforces the relationship between parameter choice and method performance.
Highlight common mistakes:
Selecting bounds that do not produce a sign change — demonstrate what happens in the script.
Confusing absolute error with relative error — reinforce the correct formula and interpretation.
Misinterpreting convergence speed — point out that smaller error tolerances require more iterations.
Promote visualization: The included plots are critical for understanding the narrowing of the interval. Encourage students to observe how xl and xu move toward the root and how xr changes with each iteration.
Reinforce algorithmic structure: Use the script to walk through the loop logic (while, condition checks, error calculation, updating bounds). This helps connect programming flow to numerical method logic.
Comparison with other methods: After running the activity, initiate a discussion comparing False Position with Bisection and Newton–Raphson in terms of convergence speed, robustness, and computational cost.
Adaptation tips:
The activity can be scaled for different class sizes by assigning each group a different function to solve.
For more advanced students, introduce modifications such as hybrid methods or alternative stopping criteria.
In online teaching, share the .mlx via MATLAB Grader so students can submit their own results for automated feedback.
Assessment
Student achievement of the activity goals can be evaluated through a combination of:
Code functionality:
The student's MATLAB implementation correctly applies the False Position Method, producing the expected root within the specified tolerance.
Code is free of syntax errors and uses appropriate programming structures (function_handle, while loop, conditional statements).
Correctness of results:
The computed root matches the reference solution within the error tolerance (Es).
The iteration table and convergence behavior are consistent with theoretical expectations.
Understanding of concepts:
Students explain why certain bounds lead to convergence and others do not (sign-change criterion).
Students interpret the meaning of relative error and stopping criteria in the context of the method.
Use of visualization:
Students correctly interpret the plots showing the interval reduction and movement of xl, xu, and xr.
Reflection or comparison (optional):
In written or oral form, students compare the False Position Method with other root-finding methods, noting advantages and limitations.
Assessment methods may include:
Automated grading via MATLAB Grader (checking code correctness and numerical output).
Submission of a Live Script with completed code, plots, and answers to reflection questions.
In-class observation during the activity to gauge engagement and problem-solving approach.
FalsePosition_assignment_Rubric.pdf (Acrobat (PDF) 254kB Nov6 25)
References and Resources
MathWorks Documentation – function_handle
https://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html
Official MATLAB documentation explaining how to create and use anonymous functions (function_handle), which are used to define the function whose root is sought in this activity.
MathWorks Documentation – while loops
https://www.mathworks.com/help/matlab/ref/while.html
Guide on how to implement while loops in MATLAB, including syntax, usage, and common patterns — essential for controlling the iteration process in the False Position Method.
MathWorks Documentation – Plotting Functions
https://www.mathworks.com/help/matlab/ref/plot.html
Overview of the plot function with examples, showing how to create 2-D line plots, label axes, and customize appearance — skills used to visualize interval narrowing and root convergence.
Numerical Methods for Engineers, 8th Edition
Chapra, S.C. & Canale, R.P. (2015). McGraw-Hill Education.
Comprehensive textbook covering numerical methods, including the False Position Method, with theoretical background, algorithm steps, and worked examples.
MIT OpenCourseWare – Numerical Methods for Root Finding
https://ocw.mit.edu/
(search for "numerical methods root finding")
Free course materials, lecture notes, and assignments on numerical root-finding methods, including closed methods like False Position and Bisection. Useful for supplementary learning.
GitHub Repository – Falsa Posición MATLAB Live Script (Replace with actual URL)
Contains the complete Falsa_Posicion.mlx file with theory, code, and instructions for use in teaching or self-study. Editable .mlx and read-only .pdf versions available.