CAE Assignment Miss Noreen
CAE Assignment Miss Noreen
MANUFACTURING
SECTION: (B)
Q1-Write down the details of Statistical functions used in matlab with
example.
1. mean() - Mean (Average)
Syntax: mean(X)
Returns the mean (average) value of the elements in the array X.
Example: X = [1, 2, 3, 4, 5];
mean_value = mean(X)
Output: mean_value = 3
2. median() - Median
Syntax: median(X)
Returns the median value of the elements in the array X.
Example: X = [1, 2, 3, 4, 5];
median_value = median(X)
Output: median_value = 3
Q2- Write down the details of Data manipulation functions used in matlab
with example.
1. max() - Returns the maximum value
Syntax: max(X) or max(X, [], dim)
Returns the maximum value in the array X.
Example: X = [1, 2, 3, 4, 5];
max_value = max(X)
Output: max_value = 5
2. min() - Returns the minimum value
Syntax: min(X) or min(X, [], dim)
Returns the minimum value in the array X.
Example: X = [1, 2, 3, 4, 5];
min_value = min(X)
Output: min_value = 1
3. sum() - Returns the sum of elements
Syntax: sum(X) or sum(X, dim)
Returns the sum of all elements in the array X.
Example: X = [1, 2, 3, 4, 5];
sum_X = sum(X)
Output: sum_X = 15
4. prod() - Returns the product of elements
Syntax: prod(X) or prod(X, dim)
Returns the product of all elements in the array X.
Example: X = [1, 2, 3, 4, 5];
prod_X = prod(X)
Output: prod_X = 120
5. sort() - Sorts elements in ascending order
Syntax: sort(X) or sort(X, dim)
Returns a sorted version of the array X.
Example: X = [3, 1, 4, 1, 5];
sorted_X = sort(X)
Output: sorted_X = [1, 1, 3, 4, 5]
Q3- Write down the details of Mathematical Functions used in matlab with
example.
Round()
x = 3.7;
y = round(x); % y = 4
Floor()
x = 3.7;
y = floor(x); % y = 3
Ceil()
x = 3.7;
y = ceil(x); % y = 4
Mod()
x = 17;
y = 5;
z = mod(x, y); % z = 2
In this example, mod(17, 5) returns the remainder of dividing 17 by 5, which is 2.
Rem()
x = 17;
y = 5;
z = rem(x, y); % z = 2
In this example, rem(17, 5) returns the remainder after dividing 17 by 5, which is 2.