Matlab. Could you please answer part 2. × ENGR 102-Homework 3. https ecampuswww.
ID: 3911460 • Letter: M
Question
Matlab. Could you please answer part 2.
× ENGR 102-Homework 3. https ecampuswww.edu/bbcswebdav/pid-4939 181-dt-content-rid-415568131 1805 ENGRT Mr. Spada ENGR 102: Engineering Problem Solving II Homework 3: 1D Arrays and Plots Solve all problems in a single seript file in Matlab. Ensure that your file is saved as LastName_FirstName HW3 before submitting, Submit your file to eCampus by Sunday 7/8/2018 at 11:59 PM. Create sets of reference values for sine, cosine, and tangent for angles ranging from 0 to 2?. Do this in two ways: (1) use a spacing of 0.5 radians, and (2) use 10 linear-spacedl points. Use output functlons to display the values in a manner which will be easily read by the user 1. 2. A spring's displacement in the x direction is defirned by the fallowing equation: where: x is the displacement of the spring at a given time, t; A is the maximunm displacement, and is the angular frequency [dependent upon the spring constant) Find the displacement of the spring from times ranging from 0 to 20 seconds at one second intervals. The maximum displacement af tho spring is known to be 3 inches. The angular frequency is known to be 0.5 radians per second.Explanation / Answer
Given below is the code for the question.
Please do rate the answer if it was helpful. Thank you
A = 3;
omega = 0.5;
t = 0:20;
x = A * cos(omega * t);
values = [t ; x]; %to use in fprintf() to print as tabular data
%display the results
fprintf('%5s %8s ', 't', 'x');
fprintf('%5d %8.2f ', values);
output
-----
t x
0 3.00
1 2.63
2 1.62
3 0.21
4 -1.25
5 -2.40
6 -2.97
7 -2.81
8 -1.96
9 -0.63
10 0.85
11 2.13
12 2.88
13 2.93
14 2.26
15 1.04
16 -0.44
17 -1.81
18 -2.73
19 -2.99
20 -2.52
?