Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Sorting data is often necessary for many engineering and data analysis applications. For this assignment, you will write a custom Matlab function that sorts

image text in transcribed
image text in transcribed
image text in transcribed
1. Sorting data is often necessary for many engineering and data analysis applications. For this assignment, you will write a custom Matlab function that sorts three numbers. Specifically, your function should take as its input argument a 1-D array of type double containing three elements. It should return the array with the elements sorted in order from smallest to largest. You may NOT use any built-in matlab functions (or loop keywords) to solve this; instead you must use decision making keywords and operators. Define an appropriate set of test cases that prove that your function always works for any set of real numbers in any order, and apply your function to those test cases. 2. Consider a nuclear reactor whose temperature is monitored by three sensors. An alarm should go on if any two of the sensor readings disagree. Write a custom Matlab function that takes the three sensor readings as input arguments and returns the string 'alarm!' as an output argument if any two of the temperature readings disagree by more than 10 degrees and 'normal' otherwise. 3. Piecewise math functions are useful when the relationship between a dependent and an independent variable cannot be represented by a single equation. For example, the velocity (v) of a rocket as a function of time (t) might be described by 11t2 5t 0 30 0 otherwise 1700e-0.2(t-30) Develop and write a Matlab function m-file that computes v as a function of t (taking t as the input argument and returning v as the output argument). Write a wrapper program using a script m-file that gets a value of time from the user, applies the function, and outputs the velocity to the screen

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_2

Step: 3

blur-text-image_3

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 Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions