由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - HELP. Symbolic substitution IN MATLAB.
相关主题
[转载] 裸泳请教matlab高手 ^_^【MATLAB 2010中符号变量设置为何总是出错】
Unix下运行Matlab程序另一问ask a question
用Matlab解方程组?GSL里面的例子是不是有的不对阿?
MatLab, 使用eval save每次都出现奇怪的11参数找不到?请教一个关于eval的问题
Analytic solution for an ODE正在interview一印度小妹,生不如死
matlab question: signum and abs[转载] lineariation problem....help, please
[转载] mathematica 和 C/C++的混合编程 -observer有人用过FORM做符号计算吗?
[转载] matlab的字符串处理功能强吗?<>全书下载
相关话题的讨论汇总
话题: symbolic话题: matlab话题: eval话题: numerical
进入Computation版参与讨论
1 (共1页)
o*****l
发帖数: 54
1
i need conversation between symbolic expression and numerical one frequently.
tried the command: subs(S,old,new). which can just substitute one specific
symbol.
what i want is, for example, x^2 + x, if i substitue x with 2, it should give
6.
thanks.
r****y
发帖数: 1437
2

Let me give you an example
syms x y
y = x^2 + x;
x = 2;
z = eval(y);
x = 4;
z1 = eval(y);
Now z = 6 and z1 = 20;
The trick is first to let y=f(x) when x and y are both sym var,
then redefine x to numerical values.
Or even simpler
y = 'x^2+x';
x = 2;
eval(y)
It will do it too.

【在 o*****l 的大作中提到】
: i need conversation between symbolic expression and numerical one frequently.
: tried the command: subs(S,old,new). which can just substitute one specific
: symbol.
: what i want is, for example, x^2 + x, if i substitue x with 2, it should give
: 6.
: thanks.

1 (共1页)
进入Computation版参与讨论
相关主题
<>全书下载Analytic solution for an ODE
[转载] help!怎么数值求解高次方程组的根?matlab question: signum and abs
matlab的symbolic object没办法转成double吗?那就是不能做图了?[转载] mathematica 和 C/C++的混合编程 -observer
matlab里面符号运算与数值运算的混合运算怎么搞啊?[转载] matlab的字符串处理功能强吗?
[转载] 裸泳请教matlab高手 ^_^【MATLAB 2010中符号变量设置为何总是出错】
Unix下运行Matlab程序另一问ask a question
用Matlab解方程组?GSL里面的例子是不是有的不对阿?
MatLab, 使用eval save每次都出现奇怪的11参数找不到?请教一个关于eval的问题
相关话题的讨论汇总
话题: symbolic话题: matlab话题: eval话题: numerical