New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

EGM 4344

by: Rollin Mann DVM
Rollin Mann DVM
GPA 3.79

Benjamin Fregly

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Benjamin Fregly
Class Notes
25 ?




Popular in Course

Popular in Engineering & Applied Science

This 5 page Class Notes was uploaded by Rollin Mann DVM on Saturday September 19, 2015. The Class Notes belongs to EGM 4344 at University of Florida taught by Benjamin Fregly in Fall. Since its upload, it has received 9 views. For similar materials see /class/207068/egm-4344-university-of-florida in Engineering & Applied Science at University of Florida.

Similar to EGM 4344 at UF

Popular in Engineering & Applied Science


Reviews for EGM 4344


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/15
PROGRAMMING TIPS AND M FILES EGM 4344 Programming Tips Key concepts 0 Divide and conquer 0 Be organized M odularigzPortability Break complicated tasks into more manageable chunks performed in separate functions Bene ts Simpli es the development and understanding by others and you of program logic Facilities debugging and testing of program components each can be tested separately Produces reliable code once debugged never need to check it again Makes repeated sections of code readily available for any problem code becomes generic rather then problem speci c and you essentially create your own library of reusable code 7 why keep reinventing the wheel Eliminates repeated sections of code that are hard to keep consistent when changes need to be made 0 Leads to good code design and much easier code writing Flags Look for tasks o where Selections and Repetitions occur 0 that are repeated in different locations 0 that could take different functions as input 0 that could be refined into groups of smaller tasks stepwise re nement Organization 1 Prologue use general purpose list of inputs and outputs as seen in gtgt help functionName 2 Get and test inputs 3 Perform computational tasks 4 Prepare outputs Readability Leave white space around different logical blocks 0 Use indentation to offset different logical blocks 0 Use meaningful but short variable names 0 Heavily comment your code Bene ts 0 You code will be much easier for you and others to understand 0 Others can gure out later what you were trying to do in your code 0 You can gure out later what you were trying to do in your code 0 Debugging becomes much easier since you or others can easily understand the program logic BJ Fregly Testing a huge weakness for most students and researchers 0 Your code is only as useful as how much it can be trusted 0 Always thoroughly test your code 0 Think up sanity checks where an obvious answer should be obtained M Files Modes of operation 1 Interactive 2 Scripts m le No inputs or outputs Internal variables left behind in workspace Variables already in workspace with same name are overwritten Usually for small repetitive tasks I rarely use them L V Functions m le Both inputs and outputs Internal variables are local to the function and are not left behind in workspace Global variables shared between functions without being passed also possible Can be combined to perform large tasks Can have one ore more functions per m file Only the function with the same name as the m file can be called from the MATLAB command window or other m files I constantly use them Syntax function outputl output2 functionNameinputl input2 where inputs and outputs can be integers oating point numbers scalars arrays anything Inside MATLAB gtgt outputl output2 functionNameinputl input2 BJ Fregly NONLINEAR BOUNDARY VALUE PROBLEM EXAMPLE The temperature distribution of the rectangular fin shown in Figure 1a below considering conduction and radiation heat transfer is given by dzT agP W k A where T temperature x location along the fin k thermal conductivity A 90 cross sectional area P 29 d perimeter T 00 surrounding temperature a StefanBoltzman constant and 8 emissivity The values for the constants are given in the table below where are values are reported in a consistent set of units T4 T gt lt1 Constant Value Units k 42 Wm 0 b 05 m d 02 m T 00 500 0 K I 2 m 8 01 dimensionless a 57gtlt108 WmZ OK4 0 1 2 3 4 3 3 3 3 3 l lt h gtlt h gtolt h gtk h gtl I b The boundary conditions are given as Tx 021000 K Txl350 K The temperature at three equally spaced interior node points 1 2 and 3 as shown in Figure 1b is to be determined using three different methods This distance h between each pair of nodes is 05 m a Using Eq 1 derive a nonlinear set of nite difference equations for the temperature at interior nodes 1 2 and 3 Use central differencing to approximate WTdx2 at each node Then write a Matlab program to solve the nonlinear system of equations for the temperature at the three nodes In your program call the fsolve rootfinding function available in Matlab using the default convergence tolerances and an intial guess of 6750 K for all three nodes Note fsolve is only available in the Optimization Toolbox so after coding your Matlab m file you will need to run it on one of the computers in NEB 109 Record your nonlinear equations and your calculated nodal temperatures to 4 significant figures in the spaces provided below Nonlinear equations Temperatures T K T 2 0 K T 0K 3 Use a Taylor series approximation to linearize Eq 1 about the reference temperature TR 675o K Then derive a linear system of finite difference equations to calculate the temperature at nodes 1 2 and 3 Use builtin Matlab linear algebra functions to solve for the three temperatures Record your linearized equations and your calculated nodal temperatures to 4 significant figures in the spaces provided below Linearized equations O V Temperatures T1 K T2 oK T3 oK Comment brie y on whether these calculated temperatures are close to those found in part a using the nonlinear version of the nite difference method Use the shooting method to solve the same problem for the temperature at nodes 1 2 and 3 Write a Matlab program to implement the method using the Matlab ode45 numerical integrator with a step size of h 05 In Use the default integrator accuracy settings and an initial guess of 8000 Km for dTdx Since the problem is highly nonlinear also use the Matlab fzero rootfinding function to automatically iterate the solution until it converges using the default convergence tolerances Record the differential equations you used and your calculated nodal temperatures to 4 significant figures in the spaces provided below Differential equations Temperatures T K T2 0 K T3 0 K


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Kyle Maynard Purdue

"When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the I made $280 on my first study guide!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.