Prev: Converting a color video into binary using specified RGB
Next: Need help in define integer programing in GA
From: Dimitrios K on 6 Jul 2010 21:48 If I have a symbolic function of x and tau, is it possible to evaluate it at specific values of x and tau in a simple manner? For example: wxt is a function of the symbolic variables x and tau to be specific: wxt = (7065071323251339*cos((879*tau)/250)*heaviside(tau - 10)*((82945812233899378607857*cos((18751*x)/10000))/450359962737049600000000 - (82945812233899378607857*cosh((18751*x)/10000))/450359962737049600000000 - (13520329*sin((18751*x)/10000))/100000000 + (13520329*sinh((18751*x)/10000))/100000000))/222698606060234720 + (416670610128987*cos((61697*tau)/1000)*heaviside(tau - 10)*((7031072543531451991639*cos((19637*x)/2500))/28147497671065600000000 - (7031072543531451991639*cosh((19637*x)/2500))/28147497671065600000000 - (1560001*sin((19637*x)/2500))/6250000 + (1560001*sinh((19637*x)/2500))/6250000))/12467666322466045952 - (7818029682713243*cos((11017*tau)/500)*heaviside(tau - 10)*((9175928402955814601981*cos((46941*x)/10000))/36028797018963968000000 - (9175928402955814601981*cosh((46941*x)/10000))/36028797018963968000000 - (25938649*sin((46941*x)/10000))/100000000 + (25938649*sinh((46941*x)/10000))/100000000))/17491878486808283136 I want to know wxt @ x=L, tau=t. Is there a simple way to accomplish this without jumping through hoops? Thanks
From: Walter Roberson on 6 Jul 2010 22:24 Dimitrios K wrote: > If I have a symbolic function of x and tau, is it possible to evaluate > it at specific values of x and tau in a simple manner? You can use subs() . Note though that when trig functions are applied to rational numbers, that unless the fraction happens to be one of the easily converted ones, that automatic simplification will not be applied to the argument. I do not know enough about MuPad to say whether in such a case MuPad will recognize combinations of trig functions that can be further reduced (e.g., condensing trig identities); it might possibly sometimes help to simple() the subs() result. If you want to force reduction into a decimal value, use vpa() on the subs() result if you want a symbolic number with a specific number of decimal places, or use double() on the subs() result if you want the value as a Matlab floating point number.
From: Dimitrios K on 7 Jul 2010 16:38
Walter Roberson <roberson(a)hushmail.com> wrote in message <UzRYn.7915$Hw.4691(a)newsfe10.iad>... > Dimitrios K wrote: > > If I have a symbolic function of x and tau, is it possible to evaluate > > it at specific values of x and tau in a simple manner? > > You can use subs() . > > Note though that when trig functions are applied to rational numbers, > that unless the fraction happens to be one of the easily converted ones, > that automatic simplification will not be applied to the argument. I do > not know enough about MuPad to say whether in such a case MuPad will > recognize combinations of trig functions that can be further reduced > (e.g., condensing trig identities); it might possibly sometimes help to > simple() the subs() result. > > If you want to force reduction into a decimal value, use vpa() on the > subs() result if you want a symbolic number with a specific number of > decimal places, or use double() on the subs() result if you want the > value as a Matlab floating point number. Thanks for the help! I got it working with subs as you suggested. Took me a while to figure out the syntax for replacing two variables, but here it is: subs(wxt,{x,tau},{x2,tau2}) |