MATLAB Flashcards
1
Q
if (expression)
statements
elseif (expression)
Statements
else if
Statements
end
A
“If” statement
2
Q
repeatedly execute a block of code
For:
x = ones(1,10);
for n = 2:6
x(n) - 2*x(n-1);
end
While:
n =1;
nfactorial =1;
while nfactorial <1e100
n = n+1;
nfactorial = nfactorial*n;
end
A
MATLAB Loop structures