Answered step by step
Verified Expert Solution
Question
1 Approved Answer
slove this by using matlab. Overview: this exercise, you will be writing a function that finds what spring constant k is required in order to
slove this by using matlab.
Overview: this exercise, you will be writing a function that finds what spring constant k is required in order to minimise the RMSE of a spring stiffness test. You will need to apply the function rmse(data,k) defined in Exercise 3. You do not have to code this function yourselfhere. This function is provided to you and can be called as rmse(data,k) e function rmse was prepared by us as a working solution to Exercise 3. You can execute it in your code by calling it lke any other Matlab in-buit function uts: data - this is a matrix containing data from a spring stiffiness test. Column 1 is the force data and column 2 is the displacement data Your code should work regardless of how many rows data guess - this is an initial guess for the spring stiffhess Outputs k best-the value for k tat minimises the root mean square error between the displacement data, and the displacement predicted from x-FA. cess: o try and find the spring constant that minimizes RMSE, you will need to create a for loop that can compute the RMSE between the displacement data and the displacement predicted from x F/k or different k values. It should do this or 100 values with n 20% ofthe r put k guess note this vector 1s created for you he unction template After this loop, you can then apply e min function to find the k value that produced the minimum root mean square error (this is also provided in the template) seful Functions: for, end, rms, min, length unction Template: function best_krmse_min (data,k_guess) k linspace(8.8*k-guess,1.2*k-guess); %k values within 20% of k-guess = % Discretise the function k-> rmse(data, k) using a for loop that % calculates the root mean square errors for all values in the vector k % and stores these errors in a vector RMSE: % INSERT CODE % find the global inimum of this function of k: [rmseMin, index] -min (RMSE); % RMSE is vector defined by you above % return the best value of k: best-k = k(index) ; enStep 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