
204 Programming for Chemical Engineers
7 conc = init_conc - (k*time);
8 fprintf(‘ %d\t\t\t\t%f\n’,time,conc);
9 time=time+10;
10 end
Lines 6 to 10: Similarly, these lines cover the while loop statement. In the loop,
fprintf() is utilized to print the resulting conc. The loop stops when
the value of
time reaches more than 60.
SCALARS, VECTORS, AND MATRICES
Initialization
MATLAB, which is short for MATrix LABoratory, was initially designed solely to
perform matrix calculation. After reading the section, we will better appreciate
this technical programming language specifically for handling arrays.
Initializing a scalar (1 × 1 array), a vector (one-dimensional ...