Question: 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.

 6. Write a MATLAB script (code) to model a spring-mass system

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!