%% Homework #0
% First, Last
% Math 365, Spring 2016
%% Introduction
% The purpose of this homework is to become familar with the Matlab publish
% command and to see how to turn in homework problems.
function hmwk0()
% Call your homework problems like this :
hmwk_problem(@prob1,'prob1');
hmwk_problem(@prob2,'prob2');
hmwk_problem(@prob3,'prob3');
hmwk_problem(@prob4,'prob4');
hmwk_problem(@prob5,'prob5');
hmwk_problem(@prob6,'prob6');
hmwk_problem(@prob7,'prob7');
hmwk_problem(@prob8,'prob8');
end
function hmwk_problem(prob,msg)
try
prob()
fprintf('%s : Success!\n',msg);
catch me
fprintf('%s : Something went wrong.\n',msg);
fprintf('%s\n',me.message);
end
fprintf('\n');
end
%% Problem #1 : Surface area of a torus
% In this problem, we compute the surface area of a torus whose
% inner radius is 3.21 and whose outer radius is 3.56.
% The result is saved to the file 'torus.out'
function prob1()
% Your work goes here
end
%% Problem #2 : Smartphones
function prob2()
% Your work goes here
end
%% Problem #3 : Vectorizing calculations
function prob3()
%%%
% Matlab makes it very easy to manipulate vectors and arrays. Many
% commands that would normally require a "for" loop can be "vectorized",
% creating code that is generally faster and more compact than
% non-vectorized equivalents.
% Your work goes here
end
%% Problem #4 : Plot the graph of a function
function prob4()
%%%
% Create function handles for two functions and
% construct a third composite function.
% Your work goes here
end
%% Problem #5 : Continued fraction approx. to pi
function prob5()
%%%
% Use a continued fraction to approximate $\pi$. Make sure that your
% code doesn't run off of the edge of the page.
% Your work goes here
end
%% Problem #6 : Continued fraction approx. to e
function prob6()
% Your work goes here
end
%% Problem #7 : Loading data from a file
function prob7()
%%%
% Load data from a file and report the mean and standard deviation.
% Your work goes here
end
%% Problem #8 : How to succeed in Math 365
function prob8()
%%%
% Publish allows you to create lists, use different font styles, and include
% preformatted code.
%
% Typeset the text below using Matlab Publish markup language. See the
% solutions from the course website to see what the final document should
% look like.
%
% How to succeed in Math 365
%
% Always start your homework early
% Don't spend too much time googling for answers
% Read the
%
% Steps for getting help on homework problems.
%
% Read the Matlab tutorials available on the course website
% Read lecture notes and demo codes on the online website.
% Use Matlab online "help" system for help on Matlab commands.
% Read the
% Email the professor for help, if you can't find answers in the above.
% Do not spend too much time with Prof. Google or Dr. YouTube. This
% is likely going to be a waste of time! Spend more time thinking about
% what you have learned in class, and debugging your own code.
%
% Include sample code that you don't want run by "formatting" the code
% like this. Use exactly three spaces between the percent sign and
% your code.
%
% curly = 4*pi;
% larry = sin(curly);
% moe = tan(curly + larry);
%
% There are lots of helpful hints for publishing by issuing the command
%
% >> doc publishing markup
end