Built-in Functions in MATLAB

🧠 Built-in Functions in MATLAB
They help write short, fast, and readable code.
MATLAB is developed by MathWorks.
🔹 What Are Built-in Functions?
Built-in functions:
Are already available in MATLAB
Do not require user definition
Are optimized for speed and accuracy
Work on scalars, vectors, and matrices
1️⃣ Mathematical Built-in Functions
🔸 Example: sqrt()
Output
🔸 Example: pow2() / power()
Output
🔸 Common Math Functions
| Function | Description |
|---|---|
abs() | Absolute value |
sqrt() | Square root |
power() | Power |
round() | Round to nearest |
floor() | Round down |
ceil() | Round up |
mod() | Remainder |
2️⃣ Trigonometric Functions
(All angles in radians)
Output
3️⃣ Statistical Built-in Functions
Output
4️⃣ Matrix & Array Built-in Functions
🔸 Size & Length
Output
🔸 Sorting
Output
🔸 Transpose
5️⃣ Logical & Relational Functions
Output
6️⃣ String Built-in Functions
Output
7️⃣ Plotting Built-in Functions
📌 Creates a simple graph 📈
🔍 How to Find Built-in Functions
🎯 Interview Questions: Built-in Functions in MATLAB
🔹 Q1. What are built-in functions?
Answer:
Predefined functions available in MATLAB for common operations.
🔹 Q2. Give examples of mathematical built-in functions.
Answer:sqrt(), abs(), round(), mod().
🔹 Q3. Which function finds the average of values?
Answer:mean().
🔹 Q4. What is the use of size()?
Answer:
Returns rows and columns of an array.
🔹 Q5. Which function converts text to uppercase?
Answer:upper().
🔹 Q6. Are built-in functions faster than user-defined ones?
Answer:
Yes, they are optimized.
🔹 Q7. How do you get help for a function?
Answer:
Using help or doc.
✅ Summary
Built-in functions save time
Cover math, arrays, strings, plots
Highly optimized and reliable
Essential for MATLAB programming
