Built in Functions Demo Student
Built in Functions Demo Student
For this part of the demo, the following commands are typed into MATLAB’s Command Window
Command Explanation
a = 5
a2 = [0:15:180]
a3 = [0:1:10]
a4 = [a3; 5*a3]
a5 = [0:0.5:5; 0:1:10]
q = randi(10)
s = randi(100,5)
u = randi([-5 60],[8 5])
k = zeros(5)
K = ones(2,8)
V = 5*ones(1,3)
Command Explanation
b = sin(a*pi)
b2 = sind(a2)
d = sqrt(a)
d2 = sqrt(a3)
f = nthroot(a3,3)
F = power(a3,3)
AA = exp(a)
BB = log(a)
CC = log10(a)
Command Explanation
g = length(a2)
G = length(a)
[r c] = size(a5)
h = size(a4)
Command Explanation
n = [23 56 34 73 12 68]
N = sort(n)
Nd = sort(n,'descend')
p = [56 75 18; 23 45 8]
P = sort (p)
Pd = sort (p,2)
KK = sum(n)
K1 = sum(p)
K2 = sum(sum(p))
K3 = sum(p,2)
K4 = mean(n)
K5 = median(n)
M = max(n)
[A, B] = min(n)
M = max(p)
M = max(p,[],2)
M = max(max(p))
[A, B] = min(min(p))
Command Explanation
j = [1 3 1 5 7 7 7 5 5];
UNIQ = unique(j)
Command Explanation
[X, Y] = find(u == enter
an applicable number
here)
Warning: Do not use random functions or code segments found in the internet.
If you can't explain what a function does in detail,
you will not be allowed to use it and will receive a zero on the assignment.