Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

must be in matlab format 1. Cal X Lab Assignment 1 F15 area of t X NO Error - Math 261 Unlied Calculus x +

must be in matlab format
image text in transcribed
image text in transcribed
1. Cal X Lab Assignment 1 F15 area of t X NO Error - Math 261 Unlied Calculus x + pid-1566607-dt-content-rid-67167015_1/courses/Csci 251 Hopper_ALL 2019-2020_SPRG/Lab%20Assignment%201%20F led Gear Axe C... Bow Fishing Lights Myolemiss w Blackboard Ole Miss Math 261 Calender Kawasaki Brute Fu Lab Assignment 1 - Area of Triangle CSCI 251 Problem Statement For lab assignment 1 you will use the following formula to calculate the area of a triangle given the lengths of its sides: Area = V s(s - x)( sy)(s - Z) where x, y and z denote the sides of the triangle, and s is calculated as S = (1/2)(x + y +z) For this assignment, we will assume that all entries for x, y, and z produce a valid triangle Input . x = length of one side of triangle, inches y = length of one side of triangle, inches : = length of one side of triangle, inches Output Data The three sides of the triangle: x, y, and z Total area in square centimeters Before You Begin 1. Download the MATLAB starting file triangleArea.m from Blackboard (under Lab Assignments) and save to your flash drive. 2. Start MATLAB (Start > All Programs > MATLAB R2015a) and change your current Folder to the location of your flash drive (e.g., K/MATLAB programs/) If you forget to do this, your MATLAB programs will not be accessible whenever the computers in this lab are cleared, which is throughout the semester 3. In the Command Window, type edit triangleArea.m MATLAB should open the file if you have saved it in the correct location of the current folder. Getting Started 1. Include header comments formatted as show below, using your own name and ID number % CSCI 251. Section X Lab Assignment 1 F15 _ area oft x Error - Math 261 Unified Calculux + 07 dt content-rid-67167015 1/courses/Csci 251_Hopper ALL_2019-2020 SPRG/Lab%20Assignment%201%20F C... > Bow Fishing Lights Myolemiss Blackboard Ole Miss Bu Math 261 Calender Kawasaki Brute Fo Algorithm 1. Begin your program with clc clear to clear the Command Window and Workspace windows, respectively. 2. Prompt (ask) the user for the length of one side (x) of the triangle in inches using MATLAB's input command. In the Command Window, type help input on how to read input from the keyboard. 3. Prompt (ask) the user for the length of one side (y) of the triangle in inches using MATLAB's input command. In the Command Window, type help input on how to read input from the keyboard. 4. Prompt (ask) the user for the length of one side (z) of the triangle in inches using MATLAB's input command. In the Command Window, type help input on how to read input from the keyboard. 5. Convert each of the three sides -- x, y, and z-to centimeters (use three separate equations). Recall that the conversion from inches to cm: 1 inch = 2.54 cm 6. Calculate s using the following formula (same as on page 1). Note: you will need to change the syntax to conform to MATLAB: S = (x + y + x) 7. Calculate the area using the following formula (same as on page 1), again changing the syntax to conform to MATLAB: Area = s(s - x)(s - y) (s - Z) To find the square root, use either sqrt() or (0.5) in your calculation 8. Using MATLAB's fprintf command, echo the sides of the triangle (cm) in the honeycomb as well as the area in square centimeters. Only use one fprintf. 9. In Command Window type help fprintf for more details. Note: ' ' will output a blank line. 10. Before each significant step, provide a comment explaining the step (do not comment every line of code). Sample Output Enter side x in inches: 4 Enter side y in inches: 5 Enter side z in inches: 6 For a triangle of sides 10.16 cm, 12.7 cm, and 15.24 cm Area = 64.01 square cm Test Plan In order to receive credit, you must show the TA the test cases below. Also, submit your lab assignment on Blackboard under Lab Assignments (Click on the words Lab Assignment 1. scroll down to Browse My Computer navigate and click the triangleArea. mile, scroll down

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions