Thread Subject: problem with subs

Subject: problem with subs

From: David Doria

Date: 25 Feb, 2008 22:08:05

Message: 1 of 2

I make a big 4x4 matrix of second partials:

------

syms A N sigma omega phi x t positive
lnf = -N/2 * log(2*pi*sigma) + -1/(2*sigma)*(x -
A*cos(omega*t - phi));
F=[diff(diff(lnf,A),A) diff(diff(lnf,A),omega)
diff(diff(lnf,A),phi) diff(diff(lnf,A),sigma);
diff(diff(lnf,omega),A) diff(diff(lnf,omega),omega)
diff(diff(lnf,omega),phi) diff(diff(lnf,omega),sigma);
diff(diff(lnf,phi),A) diff(diff(lnf,phi),omega)
diff(diff(lnf,phi),phi) diff(diff(lnf,phi),sigma);
diff(diff(lnf,sigma),A) diff(diff(lnf,sigma),omega)
diff(diff(lnf,sigma),phi) diff(diff(lnf,sigma),sigma)];

----------

Then I want to substitute some values:
subs(F, {A,omega, phi, sigma}, {1, 1, 1, 1})

it doesn't work.

I tried
subs(F(1,2), {A,omega, phi, sigma}, {1, 1, 1, 1})

still no success.

However, if I do F(1,2) then manually copy and paste:
subs(1/2/sigma*sin(-omega*t+phi)*t, {A,omega, phi, sigma},
{1, 1, 1, 1})

it works properly.

Is there a way to do this automatically?

Thanks,

Dave

Subject: problem with subs

From: David Doria

Date: 26 Feb, 2008 12:25:04

Message: 2 of 2

is this not a normal thing to need to do?

Thanks,
Dave
bump

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com