Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab This problem practices several skills. You will follow a flowchart with a non-sequential structure and function definition. You will write a user-defined function that

Matlab

This problem practices several skills. You will follow a flowchart with a non-sequential structure and function definition. You will write a user-defined function that checks for valid inputs and returns different outputs depending on those inputs.

image text in transcribedimage text in transcribedimage text in transcribed

Springs have many applications across most engineering disciplines. Springs are found in vehicle engines and suspensions, earthquake-rated buildings, hinged aircraft door mechanisms, farm equipment, medical devices, and more. A commonly used spring is a helical compression spring. This is the "standard" coiled spring that is designed to offer resistance against an axial force (i.e., a force in the direction through the open center of the spring). You are working with a design team that is sizing compression springs for a project. You are responsible for writing a program that can determine a spring's wire length (i.e., the length of wire used to manufacture the spring) and total mass when given information about the spring's parameters. You will use these equations to calculate the values you need: L=2n(do+di) Where L is the spring wire length, n is the number of coils in the spring, do is the outer diameter of the spring, and di is the inner diameter of the spring. ms=L(dodi)2 Where ms is spring mass and is the spring metal density. All springs in the system will be made with the same high-carbon steel. The steel, oil tempered ASTM A 229, has a density of 7.861g/cm3. Your program must work within a larger program structure so you must write it as a function based on what you know about the spring project and the other parts of the larger program. You know the following information: - Your function will require two inputs: one input is the inner and outer diameters of the spring, the other input is the number of coils in the spring. - The diameters and number of coils must meet certain criteria: - The diameter input variable must be a 2-element vector and the number of coils input must be a scalar. 0 The first element of the diameter vector must be the inner diameter (i.e., the smalle diameter). The inner diameter cannot be greater than 95% of the outer diameter. Both elements within the diameter vectors must be lengths between 2.5cm and 30 inclusive. - The spring must have at least 4 coils. Once you have your function working, run it with the following test cases: For each test case, paste your function call and printed display into the RESULTS section of your script as comments. You must include the function call for each test case with the results. - Suppress the output argument variables when you call the function by adding a semicolon to the end of the function call, just like with variable assignments from built-in functions. - Confirm your code results with the flowchart. If there is a discrepancy, correct your code to get the proper results

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

More Books

Students also viewed these Databases questions

Question

What is a depositary receipt?

Answered: 1 week ago

Question

Are my points each supported by at least two subpoints?

Answered: 1 week ago