ESG 111 Lecture Notes - Lecture 6: Leibniz Formula For Determinants, Matlab

146 views3 pages

Document Summary

% call a function to display a menu and get a choice choice = fn_pi_menu; % choice 4 is to exit the program if choice==4 return; end while choice ~= 4 switch choice case 1. % print result from machin"s formula fn_pi_machin case 2. % allowing user to specify # of terms fn_pi_leibnizn case 3. % until a good approximation is found fn_pi_approx end. % display menu again and get user"s choice choice = fn_pi_menu; end fn_pi_menu function choice = fn_pi_menu. % print the menu of options and error-check. % until the user pushes one of the buttons. % returns integer of user"s choice, 1-4 choice = menu("choose a pi option", "machin formula", % if the user closes the menu box rather than. % pushing one of the buttons, choice will be 0 while choice == 0 disp("error - please choose one of the options. ") choice = menu("choose a pi option", "machin formula",

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents