MATLAB Answers


Trying to evaluate a symbolic function using multiple subs / returned symbolic function with not all subs applied.

Asked by Dan
on 30 Nov 2012

Here is my code guys. Kind of stumped been at it for a while.

syms Cb kT k x a v t;
forcingFxn = (.5*k/kT*(v*t-x));
Uleft = (Cb/kT)*(2*x^2/a^2 -2/3)+ forcingFxn;
Uright  = (-Cb/kT)*(x/a-1)^2+forcingFxn;
product = Uleft*Uright;
dUl = diff(Uleft);
dUr = diff(Uright);
%%Integral of this product
integral = int(product,t);
finalExpressionForRt = exp(-integral);
substituted = subs(finalExpressionForRt,{t,x,Cb,k,kT,a,v},{1,0,40,2,4,1,1});


Displays this when run...

1/exp((8*Cb^2 - 5*Cb*k*v + k^2*v^2)/(12*kT^2))

Why are t,x,a being substituted while Cb,Kt,k and v are not???

Thanks for the help,


  1 Comment

what are you expecting to be the result for 'substituted' ?

using your code I get

substituted =

Log in to comment.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Win prizes and improve your MATLAB skills

Play today