Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Write a MATLAB script that will accomplish the tasks listed below. Name the m-file LastName_Lab2.m where LastName is your last name. Separate code for

image text in transcribed
. Write a MATLAB script that will accomplish the tasks listed below. Name the m-file LastName_Lab2.m where LastName is your last name. Separate code for each task by sections (where a section is defined by %%) and label the sections. Comment all of your work. Submit your lab m-file using Canvas. Feel free to discuss the lab assignment, but you must do your own work. Feel free to use any resources available to find the necessary formulas. You can use clc to clear the command window, but do not use clear to clear the workspace. (The TAs will define variables in the workspace before running your script in order to test it.) (Do not echo the results of the tasks below to the MATLAB Command Window.) Tasks 1. If the surface area of a sphere is defined as variable SA sphere, determine the radius and assign the result to radius sphere. Hint: you can use either the built-in function sort o Tsee help sart) or raise the value to the 1/2 power (see help to determine the square root of a number. 2. Detemine the volume of a disk and assign the result to vol_disk, if the radius and height of the disk are given as r_disk and h_disk, respectively. 3. If three points are given as p1, p2, and p3, where each point is defined by an x and y coordinate, determine the area of the triangle defined by the three points and assign the result to area_triangle. Hint: make sure to take the absolute value of the result (see help abs in MATLAB) 4. Using the same points given in Task 3, determine the centroid of the triangle defined by the three points and assign the result to centroid_triangle. 5. Given a matrix M, switch the first and last columns and assign the resulting matrix to M2. 6. Given a matrix M, switch the first and third rows and assign the resulting matrix to M3. 7. Determine the result of adding M to the result of multiplying M2 by M3 and assign the resulting matrix to M4 und

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

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions