# Matlab 4 - Part A Convert.m prompt ='Please input the...

• Homework Help
• 8
• 100% (8) 8 out of 8 people found this document helpful

This preview shows pages 1–4. Sign up to view the full content.

Part A Convert.m prompt = 'Please input the points the student earned:' ; points = input(prompt); Finalgrade = Grade(points); Grade.m function g=grade(Points) if Points>=510 g=[ 'A' ,plus_minus(Points,540,570)]; elseif Points>=420 g=[ 'B' ,plus_minus(Points,450,480)]; elseif Points>=360 g=[ 'C' ,plus_minus(Points,380,400)]; elseif Points>=300 g=[ 'D' ,plus_minus(Points,320,340)]; elseif Points>=0 g=[ 'E' ]; end Plus_minus.m function pm = plus_minus(points,lpoint,hpoint) if points < lpoint pm= '-' ; elseif (points > lpoint) && (points < hpoint); pm= '' ; else points > hpoint; pm= '+' ; end Part B function SUM = add(P,Q) P=input( 'Enter Polynomial 1 \n' ) Q=input( 'Enter Polynomial 2 \n' ) Vec=(size(P)-size(Q)); if Vec(2)<0; R = [zeros(1,Vec(2)),P]; SUM = R + Q; else Vec(2)>0; R = [zeros(1,Vec(2)),Q]; SUM = R + P; end Part C

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

function c=cheby(n) c0 = [1]; c1 = [1,0]; i=1 ; if n==0 c=c0; elseif n == 1 c=c1; else ci2 = c0; ci1 = c1; while i < n i = i + 1; ci = add(conv([2 0],-ci1),-ci2); ci2 = ci1; ci1 = ci; end end r=roots end Answers to the following are in a Blue font color
University of Massachusetts Lowell Electrical and Computer Engineering 25.108 Intro to Engineering II for ECE Writing Programs and functions in Matlab Date: __10/6/15 _______ Section # ______828 _______ Learning Objectives: By completing this Lab exercise you should be competent in the following learning objectives: · Getting more experience with Matlab functions · Using commands: while, if then – elseif to control program structure · Writing simple programs in Matlab Instructions: Part A. Grading Problem, Using Control Structures In 25108, all the Labs, MPs and exams consist 600 points. The final letter grade is given

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

This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern