Problem 2. Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, so you can also type
x = [1, 2, 3, 4]
Create the vector
x = [1 2 3 4 5 6 7 8 9 10]
There's a faster way to do it using MATLAB's colon notation.
Solution Stats
Problem Comments
-
44 Comments
Show
41 older comments
Alessandro
on 23 Jan 2024
this was a very cool problem
Tejas
on 26 Mar 2024
very simple
Robert
on 19 Nov 2024
I really liked this problem. Short and simple.
Solution Comments
Show commentsGroup

M3 Challenge Problem Group
- 20 Problems
- 20 Finishers
- Add two numbers
- Return area of square
- Make the vector [1 2 3 4 5 6 7 8 9 10]
- Calculate Amount of Cake Frosting
- Sum all integers from 1 to 2^n
- Reverse the vector
- Magic is simple (for beginners)
- Solve a System of Linear Equations
- Roll the Dice!
- Chess probability
- Throwing Dice - Will You Be Eaten By The Dragon?
- The Birthday Phenomenon
- Fibonacci sequence
- Monte-Carlo integration
- Make a Plot with Functions
- Differential equations I
- Numerical Integration
- Create initial basic feasible solution for transportation problems - North-West Corner Method
- Create initial basic feasible solution for transportation problems -Minimum Cost Method
- There are 10 types of people in the world
Problem Recent Solvers50179
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!