Presentation is loading. Please wait.

Presentation is loading. Please wait.

conversion factor functions

Similar presentations


Presentation on theme: "conversion factor functions"— Presentation transcript:

1 conversion factor functions
should be simple - not complex ft_to_m: fpminsq_to_mpssq: min_to_s: 60 convert acc = 325 ft/min/min to m/s/s acc*ft_to_m/min_to_s/min_to_s = 325*0.3048/60/60 = acc* fpminsq_to_mpssq = 325* = = 325* = we want to maintain as much accuracy as possible avoid ROUNDOFF errors Engr 0012 (04-1) LecNotes 08-01

2 annotating your scripts and functions
function [principal, balance, rate, years] = calcinfo( ) % get user input to financial calculation problem % needs: nothing % returns: stuff user entered % ... function [principal, balance, rate, years] = calcinfo( ) % get user input to financial calculation problem % needs: nothing % returns: principal principal invested, $ % balance balance after years, $ % rate annual interest rate, % % years number of years invested, years % ... Engr 0012 (04-1) LecNotes 08-02

3 display of results is limited will display the text
disp( 'A line of text' ) disp( var_name ) will display value of var_name but - only under current format full control of everything - Workshop 5 fprintf('control string', value list) fprintf('\nInvesting a prinicpal of $%12.2f', principal) fprintf('\nfor %6.2f years at %6.3f%%', years, rate) fprintf('\ncreates a balance of $%12.2f', balance) Engr 0012 (04-1) LecNotes 08-03

4 programming assignment 04
due Wed 24 Sep class activity 08 : ca08_e12(04-1).pdf Engr 0012 (04-1) LecNotes 08-04


Download ppt "conversion factor functions"

Similar presentations


Ads by Google