Plotting Total Energy vs Time for Damped System (MATLAB)

In summary, The student was trying to solve for the energy in a damped system, but was stuck. They were told to solve for x and use ode45 to solve for U and T. However, when they tried to do this, the dimensions of the matrix decreased, which prevented them from adding the potential and kinetic energies.
  • #1
krnhseya
103
0
1. Homework Statement

Plot total energy vs. time graph using MATLAB (damped system)

wn(the undamped natural frequency) = 2 rad/s
damping ratio, z = 0.01
mass = 10kg
initial displacement = 0.1
initial velocity = 0

2. Homework Equations

KE = (1/2)mv^2
PE = mgh

3. The Attempt at a Solution

I can get damping coefficient but that's about it...
I don't really know where to start from...
 
Physics news on Phys.org
  • #2
Is this for a simple harmonic oscillator? I mean all you really have to do is define your constants and then relate the damped SHO to total energy. As you can presume, you should see your energy die out.

In the end you should just have something like

plot(totalEnergy, t),labels,etc.

Do you have a specific question?
 
  • #3
Yes it is SHO and...
Tmax = (1/2)m(Wn*A)^2
Umax = (1/2)k(A)^2

Both come out to be 0.2 Joules but I am just stuck.
I know that the graph should be linear with a negative slope coming down from 0.2 joules but I don't know how to set it up.
I've solved other questions and I have NO IDEA how I got stuck with this problem. :(

(PE and KE goes back and forth like sin graphs except they go opposite direction...and I know it's underdamped(I don't know if that has anything to do with this problem.)

Also, I can figure out the displacement function, x(t) = A sin (wt + phi) but I don't think that's needed;
 
Last edited:
  • #4
So you know that the potential energy is

[tex]U(x)=\frac{1}{2}kx^2[/tex]

and the kinetic energy has a couple form you can use, one of which is

[tex]T(|\dot{x}|)=\frac{1}{2}m|\dot{x}|^2[/tex]

Let MATLAB do the all the work for you.
 
  • #5
Total energy = T - U or U - T...then it's always 0
I don't get it;

[edit]
input k, x, and m.
then for x dot, x/t where t=0:0.01:10;

total energy = T - U
plot(?)

well that doesn't work...
 
Last edited:
  • #6
Total energy is kinetic plus potential.

I mean, I don't really know how your class is structured or anything, so I don't know where to start helping. If I were to start on this problem I would separate the second order ode into a system of first odes, and the use ode45 to solve the two. Use the results from those to add the potential and kinetic energies for the plot.
 
  • #7
Mindscrape said:
Total energy is kinetic plus potential.

I mean, I don't really know how your class is structured or anything, so I don't know where to start helping. If I were to start on this problem I would separate the second order ode into a system of first odes, and the use ode45 to solve the two. Use the results from those to add the potential and kinetic energies for the plot.

i only see x dot...where's 2nd ODE come from?

input k, x, and m.
then for x dot, x/t where t=0:0.01:10;
PE=0.5*40*((0.1^2));
KE=5*((0.1./t)^2);
total energy = KE + PE
plot(t,TE)

Why does my graph look so strange though...
The graph shows that my TE is infinity at t=0 and TE approaches to 0 after t=1.
Isn't my KE and PE should be fluctuating above TE = 0 like a sine/cosine graph so that TE is constantly decreasing linearly?
I have PE as constant, which doesn't make sense neither;
 
Last edited:
  • #8
Where does this 40 and .1 business come in?

t=[0:.1:10];

%if you don't even have to solve for x and merely plug in
x = stuff;
xdot = derivative(stuff);
U = .5*k*x^2;
T = .5*m*abs(xdot)^2;
totalEnergy = T+U;
plot(t,totalEnergy)

%if you have to solve for x
u = stuff;
v = u';
[t1,x1] = ode45()
[t2,x2] = ode45()
U = .5*k*x^2;
T = .5*m*abs(xdot)^2;
totalEnergy = T+U;
plot(t,totalEnergy)

all you really have to do is fill in some things because I gave you a pseudo code
 
  • #9
40 was the K value and 0.1 is the initial displacement which was x...
i will give it a try and come back...i don't know how to take derivative in MATLAB so;;

is this "stuff" the displacement function in terms of t?

[edit] another questions that i have is that when i take the derivative, matrix dimensions decrease by one so that i can't add them.

x=0.1*(exp(-0.02.*t)).*(sin(2.*t+1.56))
xdot=diff(x,1);
tdot=diff(t);
dx_dt=xdot./tdot;
U=0.5*k*(x.^2);
T=0.5*m*abs((dx_dt).^2);
TE=T+U; <- error!
 
Last edited:

Related to Plotting Total Energy vs Time for Damped System (MATLAB)

1. What is a damped system in MATLAB?

A damped system in MATLAB refers to a physical system that has a damping force acting on it, causing it to lose energy over time. In MATLAB, this can be represented by a second-order differential equation that includes a damping coefficient.

2. How do I plot total energy vs time for a damped system in MATLAB?

To plot total energy vs time for a damped system in MATLAB, you first need to solve the differential equation for the system using a numerical solver such as ode45. Then, you can use the solution to calculate the total energy at each time step and plot it against time using the plot function.

3. Can I change the damping coefficient in the MATLAB plot?

Yes, you can change the damping coefficient in the MATLAB plot by adjusting the corresponding value in the differential equation. This will change the behavior of the system and affect the total energy vs time plot.

4. What does the shape of the total energy vs time plot indicate?

The shape of the total energy vs time plot indicates the behavior of the damped system. A decreasing slope suggests that the system is losing energy over time, while a constant slope suggests a stable energy state. A sinusoidal shape may indicate a periodic behavior in the system.

5. Is it possible to plot total energy vs time for a damped system with multiple damping coefficients?

Yes, it is possible to plot total energy vs time for a damped system with multiple damping coefficients. This can be achieved by solving the differential equation for each damping coefficient separately and plotting the total energy at each time step for each solution on the same graph.

Similar threads

  • Introductory Physics Homework Help
Replies
17
Views
548
  • Introductory Physics Homework Help
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
13
Views
16K
  • Introductory Physics Homework Help
Replies
6
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
12K
  • Introductory Physics Homework Help
Replies
1
Views
778
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
10
Views
2K
Back
Top