Week_9_LGS_Functions

Function ink or screen grab your code here lecture

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ned function ‘Num2Ltr’. function Ink or screen grab your code here: LECTURE Engineering Engineering Education function [ LetterGrade] = Num2Ltr( numgrade ) % Num2Ltr function which converts a numeric grade to a % letter grade % Only converts to A,B,C,D,F. If an invalid grade % is entered the function returns the letter 'X'. if numgrade<0 || numgrade>100 LetterGrade='X'; elseif numgrade>=90 LetterGrade='A'; elseif numgrade>=80 LetterGrade='B'; elseif numgrade>=70 LetterGrade='C'; elseif numgrade>=60 LetterGrade='D'; else LetterGrade='F'; end end % extra end rarely needed in MATLAB functions Run your function for the following grades: 89.99, 103, 72 Note that NONE of the variable names used by the function (internally) appear in your workspace. This is because those variables are LOCAL to the function. Values are passed to- and from- the function via their positions in the argument lists. LECTURE Engineering Engineering Education LECTURE Engineering Engineering Education On your own…..try adding an ‘averaging algorithm’ to the max/min program to find the average of the numbers entered……… LECTURE Engineering Engineering Education...
View Full Document

This note was uploaded on 01/28/2014 for the course ENGE 1114 taught by Professor Twknott during the Spring '06 term at Virginia Tech.

Ask a homework question - tutors are online