1 / 4

Engr 0012 (04-1) LecNotes 08-01

conversion factor functions. should be simple - not complex. ft_to_m: 0.3048. fpminsq_to_mpssq: 0.00008467. 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 = 0.02751666666667. acc* fpminsq_to_mpssq.

jelani-rios
Télécharger la présentation

Engr 0012 (04-1) LecNotes 08-01

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. conversion factor functions should be simple - not complex ft_to_m: 0.3048 fpminsq_to_mpssq: 0.00008467 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 = 0.02751666666667 acc* fpminsq_to_mpssq = 325*0.00008467 = 0.027517750000000 = 325*0.0000847 = 0.027527500000000 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 disp( ) will display the text disp( 'A line of text' ) will display value of var_name disp( 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

More Related