EngE_1114_HW5 - 12:20 M | 1 Given x EngE 1114 HW5 | 6...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1) Given: x Required: Flowchart, MatLab code, sample runs Relationships: y = 1/(2-3x) , y = (x+3) 1/3 Solution: Start INPUT .x IF .x < -3 .y = 1/(2-3x) .y = (x+3) 1/3 OUTPUT .y Stop % This function will return a function of 'y =' when % provided with value of 'x'. % Call statement: [y]=step_function(x) function  [y]=step_function(x) if  x<-3;     y=1./(2-3.*x); else     y=(x+3).^(1/3); end >> [y]=step_function(-10.5) y = 0.0299 >> [y]=step_function(-3) y = 0 >> [y]=step_function(.5) y = 1.5183 12:20 M | EngE 1114 HW5 | 6 February 2006 | Konzik, Kit | /
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2) Given: Required: Flowchart, MatLab Code, Sample runs Relationships: if P>=(H+15) and E>=(M+10), G = (P+E)/2, else G = (P+H+M+E)/4   % This function will return semester grade (G) when given:  % the homework grade (H), the project grade (P), the midterm grade, % and the exam grade (E). Call statement: semester_grade H = input ( 'Enter the homework grade of the student:   ' ); P = input ( 'Enter the project grade of the student:    ' ); M = input ( 'Enter the midterm grade of the student:   ' ); E = input ( 'Enter the exam grade of the student:    ' ); if  P>=(H+15)& E>=(M+10);     G=(P+E)/2;     fprintf( 'The semester grade of the student is %.2f\n' ,G); else     G=(P+H+M+E)/4;     fprintf( 'The semester grade of the student is %.2f\n' ,G); end   >> semester_grade Enter the homework grade of the student:   95 Enter the project grade of the student:    80
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern