MatLab Spring Damping and Energy

In summary, the problem is trying to find the equation for the energy of an oscillator with a mass and a spring constant.
  • #1
vaqueradecali
1
0
This is the entire problem. I am looking for help with part 3.

For the mass-spring system with damping, we obtain the following DE
my′′ + gammay′ + ky = 0, or y′′ + cy′ + omega^2y = 0, where c = gamma/m and omega^2 = k/m. Given m = 1,k = 4, gamma= 1, and initial conditions y(0) = 0.1, y′(0) = 0.
(1) Plot solutions y and v = y′ = dy/dt as functions of time.
(2) Plot v vs y (phase plot). Comment on the behavior of the curve.
(3) Plot the quantity E = 1/2mv^2 + 1/2ky^2 as a function of time. What do you observe?
(4) Show that dE/dt < 0 for gamma > 0 while dE/dt > 0 for gamma < 0 (analytically or by graphic).


For part 1
function Q2part1
m = 1; % mass [kg]
k = 4; % spring constant [N/m]
gamma = 1; % friction coefficient [Ns/m]
omega = sqrt(k/m); c = gamma/m;
y0 = 0.1; v0 = 0; % initial conditions
[t,Y] = ode45(@f,[0,10],[y0,v0],[],omega,c); % solve for 0<t<10
y = Y(:,1); v = Y(:,2); % retrieve y, v from Y
figure(1); plot(t,y,'b+-',t,v,'ro-'); % time series for y and v
%-------------------------------------------
function dYdt = f(t,Y,omega,c)
y = Y(1); v = Y(2);
dYdt = [ v ;-c*(v)-omega^2*y];

for part 2

function Q2part2
m = 1;
k = 4;
gamma = 1;
omega = sqrt(k/m); c = gamma/m;
y0 = 0.1; v0 = 0;
[t,Y] = ode45(@f,[0,10],[y0,v0],[],omega,c);
y = Y(:,1); v = Y(:,2);
figure(1); plot(v,y);
function dYdt = f(t,Y,omega,c)
y = Y(1); v = Y(2);
dYdt = [ v ;-c*(v)-omega^2*y];


I know that i need to plug in formulas for y (and v as well?) so that I have E(t), but is it as simple as solving for and plugging in y? I am in need of direction here I suppose...a nice big fat hint to put me in the correct direction.:biggrin:
 
Physics news on Phys.org
  • #2
I don't know which part you need help with, but if you are on part three you should look into a contour plot.

For example, here is a way to do an energy contour of a undamped oscillator with a mass of 4.5kg and a spring constant of 2N/m:

[x y]=meshgrid(-1:0.01:1,-1:0.01:1);

m=4.5;
k=2;

contour(x,y,((1/2)*m*y.^2)+((1/2)*k*x.^2),4)
title('Energy Contour Plot for Undamped Oscillations')
ylabel('Velocity')
xlabel('Position')
 
  • #3
Oh whoops, they asked for it as a function of time... which I don't quite understand. Maybe you could overlay the potential energy vs. time and the kinetic energy vs. time onto one plot.
 

Related to MatLab Spring Damping and Energy

1. What is MatLab Spring Damping and Energy?

MatLab Spring Damping and Energy is a set of functions and tools within the MatLab software that allows for the analysis and simulation of mechanical systems with springs and damping elements. It can be used to study the behavior of these systems under different conditions and to calculate the energy involved in their motion.

2. How do I use MatLab Spring Damping and Energy?

To use MatLab Spring Damping and Energy, you will need to have a basic understanding of MatLab programming language. You can access the functions and tools through the MatLab command window or by using the graphical user interface. The documentation for MatLab also provides detailed instructions and examples on how to use these functions.

3. What is the difference between spring damping and energy?

Spring damping refers to the way in which a spring responds to an external force and how it affects the motion of a system. Energy, on the other hand, refers to the ability of a system to do work and is related to the forces and motion involved. MatLab Spring Damping and Energy allows for the analysis and calculation of both spring damping and energy in mechanical systems.

4. Can MatLab Spring Damping and Energy be used for real-life applications?

Yes, MatLab Spring Damping and Energy can be used for real-life applications in various fields such as engineering, physics, and mechanical design. It can be used to study the behavior of mechanical systems and to optimize their performance by adjusting the spring and damping elements. It is also commonly used in research and development for new products and technologies.

5. Are there any limitations to using MatLab Spring Damping and Energy?

While MatLab Spring Damping and Energy is a powerful tool for analyzing and simulating mechanical systems, it does have some limitations. It is primarily designed for linear systems and may not accurately represent non-linear systems. It also assumes that the damping is proportional to the velocity, which may not always be the case in real-life systems. It is important to carefully consider these limitations when using MatLab Spring Damping and Energy for your analysis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
142
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
288
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
243
Back
Top