0
0
MATLABdata~15 mins

First MATLAB program - Mini Project: Build & Apply

Choose your learning style9 modes available
First MATLAB program
📖 Scenario: You are learning MATLAB, a tool used by engineers and scientists to solve problems with math and data. Let's start by writing your very first MATLAB program.
🎯 Goal: Create a simple MATLAB script that stores a number, doubles it, and then shows the result.
📋 What You'll Learn
Create a variable called number with the value 10
Create a variable called doubled that is twice the value of number
Display the value of doubled using disp
💡 Why This Matters
🌍 Real World
MATLAB is used in engineering and science to quickly test ideas and solve math problems.
💼 Career
Knowing how to write simple MATLAB programs is useful for jobs in data analysis, engineering, and research.
Progress0 / 4 steps
1
Create the initial variable
Create a variable called number and set it to 10.
MATLAB
Need a hint?

Use the equals sign = to assign the value 10 to the variable number.

2
Create a doubled variable
Create a variable called doubled that is number multiplied by 2.
MATLAB
Need a hint?

Multiply number by 2 using the * operator and assign it to doubled.

3
Display the doubled value
Use disp to display the value of doubled.
MATLAB
Need a hint?

Use disp(doubled); to show the value stored in doubled.

4
Run the program and see the output
Run the program to display the doubled value. The output should be 20.
MATLAB
Need a hint?

Run the script. You should see the number 20 printed in the command window.