Question: Overview: In this exercise, you will be writing a function that finds what spring constant k is required in order to minimise the RMSE of

 Overview: In this exercise, you will be writing a function thatfinds what spring constant k is required in order to minimise theRMSE of a spring stiffness test. You will need to apply the

Overview: In 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 yourself here. This function is provided to you and can be called as rmse(data,k). The function rmse was prepared by us as a working solution to Exercise 3. You can execute it in your code by calling it like any other Matlab in-built function. Inputs: data - this is a matrix containing data from a spring stiffness test. Column 1 is the force data and column 2 is the displacement data. Your code should work regardless of how many rows data has. k_guess - this is an initial guess for the spring stiffness. Outputs: k_best - the value for k that minimises the root mean square error between the displacement data, and the displacement predicted from x= F/k. Process: To 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 for different k values. It should do this for 100 values within 20% of the input k_guess (note this vector is created for you in the function template). After this loop, you can then apply the min function to find the k value that produced the minimum root mean square error (this is also provided in the template). Useful Functions: for, end, rms, min, length Function Template: function best_k = rmse_min(data,k_guess) k = linspace(0.8*k_guess, 1.2*k_guess); %k values within 20% of k_guess Overview: In 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 yourself here. This function is provided to you and can be called as rmse(data,k). The function rmse was prepared by us as a working solution to Exercise 3. You can execute it in your code by calling it like any other Matlab in-built function. Inputs: data - this is a matrix containing data from a spring stiffness test. Column 1 is the force data and column 2 is the displacement data. Your code should work regardless of how many rows data has. k_guess - this is an initial guess for the spring stiffness. Outputs: k_best - the value for k that minimises the root mean square error between the displacement data, and the displacement predicted from x= F/k. Process: To 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 for different k values. It should do this for 100 values within 20% of the input k_guess (note this vector is created for you in the function template). After this loop, you can then apply the min function to find the k value that produced the minimum root mean square error (this is also provided in the template). Useful Functions: for, end, rms, min, length Function Template: function best_k = rmse_min(data,k_guess) k = linspace(0.8*k_guess, 1.2*k_guess); %k values within 20% of k_guess

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!