This week’s sessions greatly improved my comprehension and use of if-else conditions in MATLAB programming. During the Tuesday session, I worked on coding exercises to calculate the discriminant of a quadratic equation and a person’s BMI. These exercises helped reinforce my understanding of logical operators like && and relational comparisons. On Friday, I tackled two final exam-style problems: the Postage Costing Exercise, where I learned to use the ceil() function for rounding up weights, and the Grading Exercise, which involved calculating total marks and assigning grades based on a detailed scale. Creating flowcharts for both exercises helped me visualize the program's logic, further strengthening my understanding. Key takeaways include:
Practical Applications:
Calculated the discriminant of quadratic equations and determined the nature of their roots.
Created a BMI calculator with logical conditions to categorize weight status (underweight, healthy, obese, etc.).
Final Exam-Style Exercises:
Applied real-world scenarios, such as calculating postage costs using ceil() for weight rounding.
Developed a grading program that computes total marks and assigns grades based on specific ranges.
Flowchart Visualization:
Designed flowcharts for both the Postage Costing and Grading Exercises, which clarified the program’s logical flow and enhanced my understanding of condition handling.
Programming Skills:
Improved my use of MATLAB functions and commands like input() and disp() for user interaction and output formatting.
Coding for Postage Costing Exercise
Results for Postage Costing Exercise
Flowchart for Postage Costing Exercise