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

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});
disp(substituted);

---------------------

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,

Dan

1 Comment

bym on 30 Nov 2012

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

using your code I get

substituted =
    8.7653e-029
Dan

Products

No products are associated with this question.

0 Answers

Contact us