matlab中的sub函数
来源:互联网 发布:python清屏 编辑:程序博客网 时间:2024/06/06 02:42
matlab subs函数应用,运行命令help subs
函数解释如下
subs-Symbolic substitution 符号替换
This Matlab function returns a copy of s replacing all occurrences of old with new, and then evaluating s.
example:
subs(s, old, new)
subs(s, new)
subs(s)
也就是说函数subs(s, old, new)的功能就是将s符号表达式中的所有old符号变量替换成新的new的值,然后计算s并返回。
举个例子
例子:
syms x1 x2; %创建符号变量和函数的快捷方式f=(x1-1)^2+2*(x2-2)^2+x1; %f为目标函数(两变量x1和x2)x=[3;0]; %x为初始点,x(1)=3,x(2)=0d=-[diff(f,x1);diff(f,x2)]; %分别求x1和x2的偏导数,即下降的方向. d=1-2*x1 8-4*x2d_temp=subs(d,x1,x(1)) %符号替换函数,将d表达式中所有的x1的值替换为x(1)的值,计算d并返回。
输出结果:
d_temp = -5 8 - 4*x2
阅读全文
0 0
- matlab中的sub函数
- MATLAB---matlab 中的bwlabel函数
- R中的grep、grepl、sub、gsub、regexpr、gregexpr等函数
- R中的grep、grepl、sub、gsub、regexpr、gregexpr等函数
- python中的正则替换字符串函数re.sub
- R中的grep、grepl、sub、gsub、regexpr、gregexpr等函数
- MATLAB中的S函数
- matlab中的mean函数
- MATLAB中的filter函数
- matlab中的repmat函数
- matlab中的size函数
- matlab中的sort函数
- Matlab中的aviread函数
- matlab 中的find()函数
- matlab中的square函数
- MATLAB中的worldmap函数
- MATLAB中的常用函数
- matlab中的sort函数 .
- 读取webConfig的配置节点。
- ADODB操作数据库函数SelectLimit
- Android6.0 动态权限封装(代码非原创)
- ADODB操作数据库函数GetInsertSQL
- Give root password for maintenance(or type control -D to continue)
- matlab中的sub函数
- ADODB操作数据库函数DBData和qstr
- hdu 2444 The Accomodation of Students
- protobuf中的枚举缺省值应该为ENUN_TYPE_UNSPECIFIED
- 找到工作了
- ADODB操作数据库函数GetUpdateSQL
- 存储器(五)
- spring cloud config配置
- [mac笔记]Mac搭建python+selenium环境