Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want MATLAB ONLY. NOT c program You will be instructed to solve a problem in two parts and submit siles for each part. This
I want MATLAB ONLY. NOT c program
You will be instructed to solve a problem in two parts and submit siles for each part. This demonstrates how to appro roblem by solving one smaller part at a time. By solving a smaller part correctly before adding the next, one can keep the number of statements and errors that may result from them to a minimum. This approach also demonstrates h in scope and thus the solution pr ach solving a large ow an existing problem may change gram must be modified. By saving the first part with an incremental file name, additional versions can easily be saved using subsequent names providing a good backup file Before you start writing your program Read these instructions i algorithm. Use the algorithm as comments to a ncluding the algorithm. An algorithm is a process that guides you through solving a problem and creating an guide you when writing the MATLAB program file solution for the following problem. Problem: growing number of people are becoming more health conscious watching their diet and exercising more. Statistics are available to help them monitor their progress toward becoming a healthier person. 1 compares a person's weight and height. Though t does not actually body weight. The following equation is used to calculate body mass index. Note: The mass ist he body mass index (BMI) is a statistical measure which measure the percentage of body fat, it is used to estimate a healthy height is in meters. [htlp:len.wikipedia.org/wiki/Body mass_index] mass (Kg height2(m2) Instructions for all assignment scripts: See Standards for Documentation of MATLAB Programs on the Canvas Resources page O Insert comments at the top and throughout each file Include the follow comments at the beginning of this (and ALL) files. % submitter's name, GROUP # o Grade of ZERO for files if submitter name not part of Canvas group Not in a group? GROUP# is "none". For your own protection, % other group members' names program file name, ex. assign02a.m ALL STUDENTS' NAMES MUST MATCH NAMES ON CANVAS. type "n if submitting alone % due date of the assignment ive point penalty for not joinlng your Canvas group % statement abont collaboration REQUIRED. Zero points for comments if no collaboration statement % a short narrative about what the file does o Use the algorithm given as comments throughout your program. Observe the instructor's rule for naming variables. o Use ALL CAPS for constants variable names. o Start other variables with lower case o Use descriptive variable names. Use Sample input/output as a guide. Code clarity: o Indent blocks as needed. Use Smart Indent o Divide your solution program code into sections as noted in the algorithm. -5 points for absence ofany q these required comments at the top of each file If you do not submit individually, there will be a 5 POINTS PENALTY for not joining a group on Canvas. Groups can be 2-4 students. DO NOT join a group unless you have worked with the other members. If you do, you will be removed from the group and given the grade of zero. Use blank lines as needed to group statements. Use section comments as well as the algorithm step comments Remove statements from previous assignments that do not apply to the current requirements o o Use comments to show units L Use the CONSTANT and variable names, not numbers. Exceptions are incrementers and numbers without identity No extra output, i.e. use semicolons COMP 1200m-Spring 2019-assign02-p. 1 of 3 Program: assign02a.m You are to write a program (a MATLAB script file) that prompts the user to enter a weight in pounds and a height in inches and displays the BMI with prope r labeling. The following conversion equation will also be needed in your program 1 kilogram- 2.2046 pounds I inch2.54 centimeters Problem Constants: (with units) None New commands format long, compact input ) disp () Problem Inputs: (with units) Weight in pounds Height in inches Problem Oulputs: (with units) BMI Note: BMI is not an acceptable variable; bmi is. Other varlables: (with units) Weight in kilograms Height in meters Equations See abovie Algorithm: Use as comments below get height and weight value:s compute BMI display BMI A sample program The algorithm was added as comments to guide you when writing the MATLAB program file solution for the problem. A letter is not a descriptive name, but in this equation a, b, c are commonly used as quad equation coefficients Run output: two sample runs Enter the height in inches: 70 Enter the weight in pounds: 200 The MI is: 28.697011999144642 clc, clear al1 format short Enter the height in inches: 72 Enter he weigtit in pounds; 165 The BM is: % INPUT 22.378022956508914 Get coefficients a= input ('Enter 1st coefficient (not 0); '); b - input 'Enter 2nd coefficient: ') cinput ( 'Enter 3rd coefficient: '); Start your program file by typing the following into your empty editor window . Type yoursyour group and other required information comments. COMPUTE***** . Type the algorithm as given below as comments Calculate the roots | root! (-b + sqrt (bATHO FOUR*a*c)) /(Tota) ; = - to guide you when writing the MATLAB instructions to do the tasks to solve the given problem. . Below the comment, type the MATLAB statement(s) that OUTPUT** do what the comment says. This example should help. Display coefficients and roots disp ('Given coefficients: ') disp (a) disp (b) disp (c) disp('The real roots are:') submitter's name, GROUP # her group members' names s s program file name s due date of the assignment s statements) about collaboration. See syllabus for examples.di sp (rooti) a short narrative about what the file does cle, clear al1 % INPUT % Prompt the user to enter a value for weight in pounds and height in inches. % COMPUTE Compute conversions compute bmi % OUTPUT t display bmi COMP1200n-Spring 2019-assign02-p. 2 of 3 Program: aslgu02b.m Once you have displayed the BMI. you become curious as to what weight is needed to have a BMI at a particular level. So, you decided to modify your program to compute a target weight given a height and a target BMI. To do this you will need to rewrite the BMIlequation so that it solves for mass (weight) given the already entered height and a BMI provided by the user. Remember the computed mass (weight) will be in kilograms. You will need to convert the mass to pounds before displaying it. Problem Constants http://en.wikipedia.org/wiki/File:Body_mass_index_chart.svg None. Weight [pounds] Problem Inputs: 90 0 1 1 10 12 22 20 330 0 Height in inches BMI Normalr Obese Problem Outputs: Weight in pounds Other variables: Weight in kilograms Height in meters Equatilons Algorithm: Use as comments below See above S7 get height and target BMI values compute target weight display target weight 53 Run output: Enter the height in inches: 70 Enter the target BMI: 25 The target weight in pounds is: 3 1 130 1e0 100 10 Weight [kilograms] 4050 60 70 80 174.2342 Start your program file by typing the followig into your empty editor window. Type yours/your group and other required information commchts. New commands format short, loose Continue commands: input () disp () Type the algorithm as given below as comments to guide you when writing the MATLAB instructions to do the tasks to solve the given problem. Below a comment type the MATLAB statement(s) do what the Comment says. This example should help. , submitter's name, GROUP # other group members' names s program file name % due date of the assignment statement(s) about collaboration a short narrative about what the file does clc, clear all % INPUT % Prompt the user to enter a value for height in inches and target BMI % COMPUTE % Compute height conversion % Compute weight Compute eight conversion NOTE: Your submitted filefs) MUST be spelled and cased as instructed. % t display weight One submission per group. Canvas Unks members to fles and rubric. Submit via Canvas: assign02a.m assign02b.m MATLAB script file MATLAB script file COMP1200m-Spring 2019 -assign02-p. 3 of3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started