Question: I need the answer in matlab code Problem The potential energy for a pair of frictionless masses connected by a pair of springs to a

I need the answer in matlab code

Problem

The potential energy for a pair of frictionless masses connected by a

pair of springs to a wall is:

PE = 0.5ka*x1^2 + 0.5kb*(x1-x2)^2-F*x2 (Not necessarily valid MATLAB code) % Assume that ka = 20

kb = 15;

F = 100;

Find the minimum potential energy for this system - which corresponds to % the equilibrium location of the masses.

To solve this problem follow these steps

a) Create an array of x1 values and x2 values You should

create 40 values of x1 from 0 to 10 and 30 values of x2 from 0 to 20. (This is not a suggestion -

if you don't you'll lose points.)

Mesh the variables, solve for PE and create a surface plot (surf) of the result.

Don't forget to add a title and axis labels

b) In the same figure window, using subplots, create a contour plot of % the function - and add a color bar % Don't forget to add a title and axis labels

c) Use the min function to estimate the minimum value of the function.

Also determine the corresponding x1 and x2 values at the minimum.

d) Use the built-in MATLAB function fminsearch to find the minimum. Your results should

be close but not exactly the same as the results from the brute force % method from part c.(Use your results from c to help you choose % your first guess for x1 and x2 as input to your function)

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!