Question: I need to code this into Matlab, but with the following code, I receive an Undefined function or variable 't' error. How do I fix

 I need to code this into Matlab, but with the following

I need to code this into Matlab, but with the following code, I receive an "Undefined function or variable 't'" error. How do I fix this, given the problem.

Code:

function xp = F(t,x)

xp=zeros(2,1);

xp(1)= x(2);

xp(2)= -(x(1)+(0.2 * (x(1).^3)));

[t,x(:,1)]= ode45('F', [0,20], [0,1]);

plot(t,x(:,1));

end

...Thank you!

Goal: Investigate the behavior of nonlinear springs. Tools needed: ode45, plot Description: For certain (nonlinear) spring-mass systems, the spring force is not given by Hooke's Law but instead satisfies where k > 0 is the spring constant and e is small but may be positive or negative and represents the "strength" of the spring (? = 0 gives Hooke's Law). The spring is called a hard spring if e> 0 and a soft spring ifK0. Questions: Suppose a nonlinear spring-mass system satisfies the initial value problem u(0)-0, u'(0) 1 Use ode45 and plot to answer the following: 1. Let e0.0,0.2,0.4,0.6,0.8,1.0 and plot the solutions of the above initial value problem for 0 t 20. Estimate the amplitude of the spring. Experiment with various e > 0 What appears to happen to the amplitude as E oo? Let ?+ denote the first time the mass reaches equilibrium after t-0. Estimate + when ?-0.0, 0.2, 0.4, 0.6, 0.8, 1.0. What appears to happen to + as ? 00

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!