Answered step by step
Verified Expert Solution
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.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started