Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

I am doing this mass spring system: Problem: A weight W is dropped from a height of h onto the spring supported platform in the above diagram. The maximum spring compression x can be computed by equating the weights gravitational potential ener

Asked by Suman Koirala on 19 Mar 2013

energy (h + x)∙W with the potential energy stored in

the springs. Thus

1 2

( hx ) W k 1 x 2 and 1 2 ( h x ) W k 1 x k 2 ( x d ) 2 2

if x d

if x d

Where d is the distance between the platform and the lower pair of springs.

Let k 1 = 10 4 N/m, k 2 = 1.5x10 4 N/m

a) Create an function M-file that calculates the maximum compression x as a function of

h , d, and W. Test your function for W = 100 N, h = .5 m, d = 0.1 m, and W = 2000 N,

h = .5 m, d = 0.1 m.

THis is what I have as the code.

function xdef =Untitled(k1, k2, d, W,h) xdef= (W+ sqrt(W^2 +2*k1*W*h))/k1;

for x=0:0.01:20

if x>=d x1=roots( (k1+2*k2), -(4*k2*d+1*W), (2*k2*d^2 -2*W*h)); xm=max(x1); else x1=(W+ sqrt(W^2 +2*k1*W*h))/k1; x2= (W- sqrt(W^2 +2*k1*W*h))/k1; xm=max(x1, x2); end if xm>xdef xdef=xm end end

Can anyone help me on what is not working on this. THanks for your time. I appreciate it.

0 Comments

Suman Koirala

Products

No products are associated with this question.

0 Answers

Contact us