name = input('Enter your name: ', 's'); disp(['Hello, ', name]); fprintf('Value of pi: %.3f\n', pi); Conditional and loop structures allow algorithmic thinking in MATLAB:
if x > 0 disp('Positive'); elseif x < 0 disp('Negative'); else disp('Zero'); end for i = 1:5 disp(i); end 4.6.1 matlab basis
while x < 10 x = x + 1; end Section 4.6.1 on MATLAB Basis provides the essential building blocks for using MATLAB effectively. Mastering these basics — variables, array creation, matrix operations, built-in functions, plotting, scripting, I/O, and flow control — enables students and professionals to solve linear algebra problems, analyze data, and develop algorithms efficiently. A strong grasp of this foundation is critical before moving to more advanced topics like function files, object-oriented programming, or toolboxes. name = input('Enter your name: ', 's'); disp(['Hello,