Fundamentals-of-Programming
Fundamentals of Programming
Curriculum Module
Created with R2021b. Compatible with R2021b and later releases.
Description
This curriculum module contains interactive live scripts that teach fundamental concepts and basic terminology related to programming computers. This includes discussion of inputs and outputs, numbers, strings, arrays, branches and loops. This content is broken into six instructional live scripts and one project where live script instructions are paired with a plain code practice script. Solutions are available to instuctors upon request.
These lessons can be used as part of a lecture, as activities in an instructional setting, or as interactive assignments to be completed outside of class.
Get started with the Fundamentals of Programming interactive examples
Option 1: Download to Desktop Get started by downloading and unzipping the repository. Then, double-click the FundamentalsofProgramming.prj file inside MATLAB®.
Option 2:
Log in to your MathWorks account to access your license. If you are associated with a university, use your university email to access a campus-wide license. The project will run automatically.
From there, you can follow the landing page instructions to get started with the examples. The instructions inside the live scripts will guide you through the exercises and activities. Get started with each live script by running it one section at a time. To stop running the script or a section midway (for example, if a loop is running longer than intended), click the Stop button in the RUN section of the Live Editor tab in the MATLAB Toolstrip.
Prerequisite Domain Knowledge
This module assumes familiarity with basic mathematics at a high school level. One exercise in programmingData.mlx requires the use of the quadratic formula, for instance. Understanding the chaos game requires locating points on a Cartesian coordinate system and understanding of either vectors or midpoints. Trigonometric functions are used as example functions. With respect to programming knowledge, this module is intended for absolute beginners who have used simple calculators in the past.
Details
NavigationOverview.mlx This script brings together links and short descriptions of the content in the recommended order of use.
This overview of the concepts of programming also includes discussion of errors, documentation, and other commonly encountered challenges for beginners.
Learning Goals:
- Recognize and use the terms input and output
- Recognize, interpret, and respond to messages about syntax errors
- Recognize and interpret comments in code
- Use documentation and search to learn more about how to use a programming language
- Recognize and explain the importance of attention to detail when coding
This script introduces double
and string
data types through interactive examples and exercises.
Learning Goals:
- Recognize and explain that floating point arithmetic does not operate under the same rules as real number arithmetic
- Apply the limitations of floating point arithmetic to computation
- Recognize and use strings to store and communicate textual data
- Recognize and use whitespace in string operations
- Recognize and interpret special characters that are neither text nor numbers
- Recognize and explain simple consequences of the interactions between data types
This script introduces 1, 2, and 3-D arrays, as well as a brief overview of matrix operations. Applications include both text and image data.
Learning Goals:
- Identify, create, and use vectors containing numbers or text
- Apply vector indexing to extract information from a vector
- Identify, create, and use matrices containing numbers or text
- Apply matrix indexing to extract information from a matrix
- Identify standard file types and the corresponding extensions
- Explain why file type matters and import data from external files
- Recognize and use three dimensional arrays
This script introduces the concept of conditional branching in the form of if/else branches and switch statements.
Learning Goals:
- Recognize and apply if/then branching logic to solve problems
- Recognize and apply switch branching logic to solve problems
This script introduces the concept of conditional looping in the form of for loops and while loops.
Learning Goals:
- Use for loop logic and syntax to write and execute iterative code
- Use while loop logic and syntax to write and execute repetitive code, and decide when it is the correct method
Learning Goals:
- Apply conditional branching and looping logic in context to solve problems
- Explain that different programming solutions to the same problem can run in very different amounts of time
- Identify common file formats and their extensions
- Communicating results by exporting data from a program in a standard, shareable file format
Learning Goals:
- Explain the concept of an algorithm
- Implement an algorithm presented in pseudocode
- Explain the importance of testing both code and algorithms
chaosGame.m
This plain code file presents the basic scaffolding used to build an implementation of the chaos game on a square in programmingChaosGameProject.mlx
.
CollectedProTips.mlx This live script serves as a collection of notes on using the Live Editor and the MATLAB language in the context of these scripts. All of this material is presented in the other scripts, but this one is used for reference.
Data Files
-
turkeys1.jpg
is used inprogrammingIntroduction.mlx
andprogrammingArrays.mlx
-
fileformats.mat
is used inprogrammingChaosGameProject.mlx
-
EncryptedImage.mat
is used inprogrammingAlgorithms.mlx
-
BW_Images.mat
is used inprogrammingAlgorithms.mlx
Products
MATLAB®
License
The license for this module is available in the LICENSE.md file in this GitHub repository.
Support
The solutions are available upon instructor request. If you would like to request solutions or have a question, contact the MathWorks online teaching team.
Copyright 2021-2022 The MathWorks, Inc.
Cite As
Emma Smith Zbarsky (2023). Fundamentals-of-Programming (https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.6), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Communities
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
HelperFunctions
Version | Published | Release Notes | |
---|---|---|---|
1.0.6.0 | See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.6 |
||
1.0.5 | See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.5 |
||
1.0.4 | See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.4 |
||
1.0.3 | See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.3 |
||
1.0.2 | See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.2 |
||
1.0.1 | See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming/releases/tag/v1.0.1 |
||
1.0.0 |