Re: Solving for Stiffness using a plot
- To: mathgroup at smc.vnet.net
- Subject: [mg99974] Re: Solving for Stiffness using a plot
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Wed, 20 May 2009 05:03:16 -0400 (EDT)
- References: <guu2cm$65p$1@smc.vnet.net>
I'm not sure what you mean by saying that you solve for k, but I know
that NDSolve does not want symbolic parameters. You have to assign a
value to k.
You also have to change the square brackets in k[x1[t] - x2[t]] to
round ones: k(x1[t] - x2[t]).
Additionally, you probably forgot a minus sign. And acceleration seems
to depend on positions squared. For springs the relationship usually
is m a = -k x.
The following works:
m1 = 220;
m2 = 300;
v0 = 12;
k = 1000;(*temp.I am solving for this*)
a =
NDSolve[{-k (x1[t] - x2[t]) - m1*x1''[t] == 0,
m1*x1''[t] - m2*x2''[t] == 0, x1[0] == 0, x2[0] == 0, x1'[0]=
== v0,
x2'[0] == 0}, {x1[t], x2[t]}, {t, -10, 20}]
dis = Plot[Evaluate[{x1[t] - x2[t]} /. a], {t, -10, 20}]
Cheers -- Sjoerd
On May 19, 12:41 pm, twoseat <caseyktimm... at gmail.com> wrote:
> Hello
>
> I am trying to use mathematica to solve for the stiffness of a spring =
system but I cannot figure out how to plot my equations correctly.
>
> I have:
> m1=220;
> m2=300;
> v0=12;
> k; (*temp. I am solving for this*)
>
> a = NDSolve[{k[x1[t] - x2[t]]*(x1[t] - x2[t]) - m1*x1''[t] == 0,
> m1*x1''[t] - m2*x2''[t] == 0, x1[0] == 0, x2[0] ==
= 0,
> x1'[0] == v0, x2'[0] == 0}, {x1[t], x2[t]}, {t, -10, 20}]
> dis = Plot[Evaluate[{x1[t] - x2[t]} /. a], {t, -10, 20}]
>
> This gives me multiple errors and wont plot.
>
> I am going to try to plot k[x1[t]-x2[t]]*(x1[t]-x2[t]) vs (x1[t]-x2[t]=
) to solve for k but I can't determine how to set up my equations to plot.
>
> Any help or recommendations would be appreciated!