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

Thread Subject:
symbolic equation rearrangement

Subject: symbolic equation rearrangement

From: pietro

Date: 7 Feb, 2011 22:49:03

Message: 1 of 3

Hi,

I have several symbolic equations like this one:

(bs*md*s^3 + (bd*bs + ks*md)*s^2 + (bd*ks + bs*kd)*s + kd*ks)/(md*ms*s^4 + (bd*md + bd*ms + bs*md)*s^3 + (bd*bs + kd*md + kd*ms + ks*md)*s^2 + (bd*ks + bs*kd)*s + kd*ks)

and I would like to rearrange this with respect these new variables:

w1=sqrt(k1/m1);
w2=sqrt(k2/m2);
mu=w2/w1;
cs1=bd/(2*md*w2)
cs2=bs/(2*ms*w1)


how can I get this?

Any suggestions are appreciated.

Thanks

Pietro

Subject: symbolic equation rearrangement

From: Think two, count blue.

Date: 8 Feb, 2011 00:03:18

Message: 2 of 3

On 11-02-07 04:49 PM, pietro wrote:
> Hi,
>
> I have several symbolic equations like this one:
>
> (bs*md*s^3 + (bd*bs + ks*md)*s^2 + (bd*ks + bs*kd)*s + kd*ks)/(md*ms*s^4 +
> (bd*md + bd*ms + bs*md)*s^3 + (bd*bs + kd*md + kd*ms + ks*md)*s^2 + (bd*ks +
> bs*kd)*s + kd*ks)
>
> and I would like to rearrange this with respect these new variables:
>
> w1=sqrt(k1/m1);
> w2=sqrt(k2/m2);
> mu=w2/w1;
> cs1=bd/(2*md*w2)
> cs2=bs/(2*ms*w1)
>
>
> how can I get this?
>
> Any suggestions are appreciated.
>
> Thanks
>
> Pietro

Rewrite in terms of replacing a known variable with another variable, and
re-order the substitutions so that no variable is re-used after it has been
substituted. In particular, mu=w2/w1 can be rewritten as w2=mu*w1 or as w1 =
w2/mu but either way one of w1 or w2 will be replaced, but w1 and w2 are
needed for the later substitutions. Thus, leave the rewrite in terms of mu to
last.

I think this might be valid MuPad syntax:

Revised_Expression = subs(Expression, k1, w1^2*m1, k2, w2^2*m2, bd,
2*cs1*md*w2, bs, 2*cs2*ms*w1, w2, w1*mu);


By the way: you might want to factor() the numerator before you do the
substitutions.

Subject: symbolic equation rearrangement

From: pietro

Date: 8 Feb, 2011 09:28:04

Message: 3 of 3

"Think two, count blue." <roberson@hushmail.com> wrote in message <iiq188$m72$1@nrc-news.nrc.ca>...
> On 11-02-07 04:49 PM, pietro wrote:
> > Hi,
> >
> > I have several symbolic equations like this one:
> >
> > (bs*md*s^3 + (bd*bs + ks*md)*s^2 + (bd*ks + bs*kd)*s + kd*ks)/(md*ms*s^4 +
> > (bd*md + bd*ms + bs*md)*s^3 + (bd*bs + kd*md + kd*ms + ks*md)*s^2 + (bd*ks +
> > bs*kd)*s + kd*ks)
> >
> > and I would like to rearrange this with respect these new variables:
> >
> > w1=sqrt(k1/m1);
> > w2=sqrt(k2/m2);
> > mu=w2/w1;
> > cs1=bd/(2*md*w2)
> > cs2=bs/(2*ms*w1)
> >
> >
> > how can I get this?
> >
> > Any suggestions are appreciated.
> >
> > Thanks
> >
> > Pietro
>
> Rewrite in terms of replacing a known variable with another variable, and
> re-order the substitutions so that no variable is re-used after it has been
> substituted. In particular, mu=w2/w1 can be rewritten as w2=mu*w1 or as w1 =
> w2/mu but either way one of w1 or w2 will be replaced, but w1 and w2 are
> needed for the later substitutions. Thus, leave the rewrite in terms of mu to
> last.
>
> I think this might be valid MuPad syntax:
>
> Revised_Expression = subs(Expression, k1, w1^2*m1, k2, w2^2*m2, bd,
> 2*cs1*md*w2, bs, 2*cs2*ms*w1, w2, w1*mu);
>
>
> By the way: you might want to factor() the numerator before you do the
> substitutions.

Hi Think,

yesterday was really layte when I typed the post and I have written in the right way the new variables. Anyway these are the right ones:

ws=sqrt(ks/ms);
wd=sqrt(kd/md);
mu=md/ms;
csd=bd/(2*md*wd);
css=bs/(2*ms*ws);
ftun=wd/ws;

As you suggested my I have tried in this way:
subs(tfs,[ks, kd bd bs md ms],[ws^2*ms, wd^2*md ,2*css*ms*ws,2*csd*md*wd,mu*ms ftun^2*md*ks/kd])
 
ans =
 
((ms*ws^2 + 2*csd*md*s*wd)*(ms*mu*s^2 + 2*css*ms*ws*s + md*wd^2))/(ms^2*mu*s^2*ws^2 + 2*csd*md^2*s*wd^3 + 2*css*ms^2*s*ws^3 + md*ms*wd^2*ws^2 + 2*css*ms^2*mu*s^3*ws + md*ms*mu*s^2*wd^2 + 2*csd*md*ms*mu*s^3*wd + (ftun^2*ks*md^2*s^2*wd^2)/kd + (ftun^2*ks*md*ms*mu*s^4)/kd + 4*csd*css*md*ms*s^2*wd*ws + (2*css*ftun^2*ks*md*ms*s^3*ws)/kd)

The result is far away the optimal. Simple function doesn't affect the result. what is wrong in my code?

Thanks

Pietro

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us