Question

Please write in MATLAB code: 1. Write a function called myMin4 that will take in four...

Please write in MATLAB code:

1. Write a function called myMin4 that will take in four numbers and returns the minimum value. You may NOT use the built-in min() function. Run the function for the following: myMin4(4, 8, 12, 15) myMin4(18, 9, 1, 6) myMin4(8, -2, 2, 10)

2.   Write a function called classAverage that takes in an array of numbers and returns the letter grade of the class average. The grade ranges are as follow: Average >90 = A 80<=Average <90 = B 70<=Average <80 = C 60<=Average <70 = D Average >60 = F

Run the function for the following class averages a) [70 86 95 79 80 78 80 90 66 89 89 100] b) [54 95 61 82 75 91 81 67 87 41 31 98] c) [65 25 46 72 74 55 68 74 80 30 69 67]

0 0
Add a comment Improve this question Transcribed image text
Answer #1


function minimum = myMin4(n1, n2, n3, n4)
    minimum = n1;
    if n2 < minimum
        minimum = n2;
    end
    if n3 < minimum
        minimum = n3;
    end
    if n4 < minimum
        minimum = n4;
    end
end

myMin4(4, 8, 12, 15) 
myMin4(18, 9, 1, 6) 
myMin4(8, -2, 2, 10)



Add a comment
Know the answer?
Add Answer to:
Please write in MATLAB code: 1. Write a function called myMin4 that will take in four...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • 1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand....

    1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand. b. Explain why you chose this technique over others. Year 3 Year 1 Year 2 Actual Actual Actual Forecast Forecast Forecast Demand Demand Demand Week 1 52 57 63 55 66 77 Week 2 49 58 68 69 75 65 Week 3 47 50 58 65 80 74 Week 4 60 53 58 55 78 67 57 Week 5 49 57 64 76 77...

  • Microsoft Excel Question. I'm having trouble using the vlookup function, I have calculated a final numerical...

    Microsoft Excel Question. I'm having trouble using the vlookup function, I have calculated a final numerical grade for a hypothetical course, and and trying to use a set of numerical grades with their corresponding letter grades to get a vlookup function to return the letter grade from the numerical grade. However the function for some reason only returns the lowest value out of the set grades, not the closest match. Projects Classwork Teamwork/Integrity 100 100 A+ 98 A+ 97 A...

  • The given data is the grades for people in this class. The goal here is to...

    The given data is the grades for people in this class. The goal here is to determine the factors that effect student's Grade in the class. 4) Find the mean and median for the men's and the women's Quizzes. Gender Men Women 5) Test the claim that the majority of students at this class are women. F M F F M F F F F M M F F F M F F F F M M F F M...

  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

  • Please answer all questions! thanks :) VI/ Test scores from a math midterm are as follows:...

    Please answer all questions! thanks :) VI/ Test scores from a math midterm are as follows: 79, 90, 85, 89, 70, 59, 75, 64, 83, 78, 75, 77, 78, 77, 67, 85, 74, 52, 87, 72, 69, 76, 61, 77, 93, 86, 79, 90, 74, 67, 51, 75, 77, 82, 78, 60, 86, 72, 91, 95, 82 Complete the frequency distribution table to include all data a. Class Tallies Class Midpoint Relative Cumulative Frequency relative freq boundaries Frequency 51 57...

  • 3.3 Table 3.10 shows the scores in the final examination F and the scores in two preliminary exam...

    3.3 Table 3.10 shows the scores in the final examination F and the scores in two preliminary examinations P1 and P2 for 22 students in a statistics course. The data can be found in the book's Web site. (a) Fit each of the following models to the data: Model 1 F Bo BiP Model 2 F- Model 3 : F-k) + AP,+AP, + ε Table 3.10 Examination Data: Scores in the Final (F), First Preliminary (Pi), and Second Preliminary (P2)...

  • Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and...

    Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and letterGrade. The user will type a line of input containing the student's name, then a number that represents the number of scores, followed by that many integer scores (user input is in bold below). The data type used for the input should be one of the primitive integer data types. Here are two example dialogues: Enter a student record: Maria 5 72 91 84...

  • C++: Create a grade book program that includes a class of up to 20 students each...

    C++: Create a grade book program that includes a class of up to 20 students each with 5 test grades (4 tests plus a Final). The sample gradebook input file (CSCI1306.txt) is attached. The students’ grades should be kept in an array. Once all students and their test scores are read in, calculate each student’s average (4 tests plus Final counts double) and letter grade for the class. The output of this program is a tabular grade report that is...

  • Using Dev C++, write a program to solve the problem as stated below. Write a program...

    Using Dev C++, write a program to solve the problem as stated below. Write a program will input a single integer value (all input will be exactly 8 digits long) and will store pairs of digits as individual integer values. The program will display the five 2-digit numbers as well as the average of these, each on their own line. Use a switch statement to print out Grade: and then either A (>=90), B ([80..89]), C ([70..79]), D ([60..69]) or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT