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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com