NO CELL PHONES, HEADPHONES/BUDS, NO CALCULATORS. SAVE FREQUENTLY. SAVE BEFORE PUBLISHING!!!
ONLY MATLAB MAY BE ACTIVE ON YOUR COMPUTER. Acrobat may only be open at the end, when you are ready except for publishing and actively looking at exam2q1.pdf, exam2q2.pdf, or exam2q3.pdf with it.
VARIABLE NAMES MUST BE APPROPRIATE AND CLEARLY SHOW WHAT VARIABLE IT IS OR A 50% CREDIT REDUCTION IS APPLIED.
After translation into mathematics, only Matlab may be used to solve the full problem as posed. Use the appropriate procedures as covered in the lectures.
Open notes: print-outs of lectures and homeworks allowed. You can also use your own homework .m files.
solvesys.m
(lowercase) that, assuming
that a matrix size is set before the script is called, solves
the following system of equations
solvesys.m
should initialize the system matrix and
right hand side vector to zeros, then put in the
individual nonzero coefficients using an appropriate
for
loop over the interior equations. (Do not use special
matrices here. And the nonzero coefficients of the initial and
final equations should be done separately.) The final matrix and
right hand side vector should be printed out.
Then have Matlab check whether it will be able to find a reasonable solution to the system, and if not, display a message to that effect.
Otherwise let Matlab solve the system using the proper method, and print the solution. However, assuming that the right hand sides of the equations are measured values with a relative error of 0.001, let Matlab also estimate the relative error that that solution will have, and if it is greater than 5%, let Matlab print the following warning:
*** May have an error of *%using an appropriate
fprintf
(no decimals in the percentage).
Your script should work for any reasonable value of , but use the
provided script exam2q1.m
to test it out for and .
examq2.m
) that tries to
sum the above Taylor series in terms of to the maximum achievable
accuracy, and to no more than that. However, make sure to never sum
more than 500 terms. To make the summation more efficient, use the
fact that, as long as is at least 2,
fprintf
,
print out:
Total number of terms summed: * The obtained value is 1.1234567890123456 The "exact" value is 1.1234567890123456 The difference between the two is 1.1E-12.where for the
exactvalue use as evaluated by Matlab directly. Absolutely no data numbers in the
fprintf
FORMATSTRINGs.
fprintf
.