Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

6. Write a MATLAB script (code) to model a spring-mass system and perform the tasks that are explained in a, b, c, d and e.

image text in transcribed

6. Write a MATLAB script (code) to model a spring-mass system and perform the tasks that are explained in a, b, c, d and e. a. Ask for input k (N/m), the mass m (kg), amplitude xo (m), and time, t (vector) b.Calculate the location of spring using the following equation: x=x.cos(ot), where o=sqrt(k/m) c. Write the output into a text file Spring.txt using the following format x (no need for label) t0x0 t1x1 t2 x3 d. Write a program to open the "Spring.txt" and store it into a [2 inf] matrix (called matrix Spring_Results. And, also calculate the size of Matrix Spring_Results. e. Plot the first row of the matrix (Spring_Results) against the second row with the following properties: Color of the line: Red - Edge color of the marker: blue Face color of the marker: black - Market Shape: diamond - Shape of the line: dash-dotted line

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

More Books

Students also viewed these Databases questions

Question

You have

Answered: 1 week ago