1 / 13

EGR 106 – Truss Design Project (cont.)

EGR 106 – Truss Design Project (cont.). Truss design programs Graphical interface tools in Matlab Saving and loading data Formatted output Project Assignment – part #2. Examples of truss design programs. Johns Hopkins University: http://www.jhu.edu/~virtlab/bridge/truss.htm

Download Presentation

EGR 106 – Truss Design Project (cont.)

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. EGR 106 – Truss Design Project (cont.) • Truss design programs • Graphical interface tools in Matlab • Saving and loading data • Formatted output • Project Assignment – part #2

  2. Examples of truss design programs Johns Hopkins University: http://www.jhu.edu/~virtlab/bridge/truss.htm West Point Bridge Design Contest http://bridgecontest.usma.edu/

  3. Graphical Interface Tools • The function draw_truss will be provided to allow for graphical input of joint coordinates and member definitions • To use this function: • Download the file draw_truss.m from the course web page and save it in your current directory • Include the following command in your code: [joint_def,member_def]=draw_truss

  4. Graphical Interface: the function draw_truss

  5. Importing/Exporting Data • Saving data: • save filename • save filename array1 array2 • save filename –ascii • Reading in (loading) data: • load filename • load filename array1 array2 • load filename –ascii

  6. Importing/Exporting Data - example Saving arrays to file: >> clear >> a=[1 2 3; 4 5 6] a = 1 2 3 4 5 6 >> b=[7 8 9] b = 7 8 9 >> save arrays_a_and_b a b Loading arrays from a file: >> clear >> load arrays_a_and_b a b >> a a = 1 2 3 4 5 6 >> b b = 7 8 9 Creates file arrays_a_and_b.mat

  7. Formatted print command: fprintf(format,data) Combines text and data Allows complete control of the output format is a string (in quotes) containing text and control commands (using \ or %) See text pages 87-94 for more details Formatted output

  8. The data itself \n = new line Formatted output (cont.) An example: %d = put data here

  9. Formatted output (cont.) Escape characters: • New line ( \n ), backspace ( \b ), tab ( \t ), …

  10. Conversion codes for data: Decimal ( %d ), character ( %c ), exponential notation ( %e ), fixed precision ( %f ), … Can add field width and precision information: 5 characters wide, 2 after the decimal point Formatted output (cont.)

  11. Formatted output (cont.) fprintf works element-by-element on array data: \n added for line return

  12. w indicates “write” Formatted output to a file To write to a file: fid = fopen( 'name', 'w' ) fprintf(fid,format,data) … fclose(fid) • fid is a variable name to specify which file • name is the name of the file

  13. Truss Project – Assignment #2* Starting with your code from assignment #1: • Allow user to load results from previous design • Use function draw_truss to create new design • Develop code to allow user to define boundary conditions, forces and member width and thickness • Compute total length of members, mass of each member and total mass of truss • Allow user to save truss design • Have code create output file summarizing design parameters • Look for additional features to make your code more user friendly * See handout for details

More Related