| 查看: 1302 | 回复: 12 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
[交流]
关于高斯迭代求方程组
|
|||
|
x(j)不是x的第几列元素值吗?开始不是z值赋给了x(i),为什么是j啊,不应该乘的是x(j)嘛 发自小木虫Android客户端 |
» 本帖已获得的红花(最新10朵)
» 猜你喜欢
依托企业入选了国家启明计划青年人才。有无高校可以引进的。
已经有13人回复
AI 太可怕了,写基金时,提出想法,直接生成的文字比自己想得深远,还有科学性
已经有11人回复
表哥与省会女结婚,父母去帮带孩子被省会女气回家生重病了
已经有9人回复
同年申请2项不同项目,第1个项目里不写第2个项目的信息,可以吗
已经有10人回复
依托企业入选了国家启明计划青年人才。有无高校可以引进的。
已经有11人回复
|
例?求下列非线性方程组在(0.5,0.5) 附近的数值解。 (1) 建立函数文件myfun.m。 function q=myfun(p) x=p(1); y=p(2); q(1)=x-0.6*sin(x)-0.3*cos(y); q(2)=y-0.6*cos(x)+0.3*sin(y); (2) 在给定的初值x0=0.5,y0=0.5下,调用fsolve函数求方程的根。 x=fsolve('myfun',[0.5,0.5]',optimset('Display','off')) x = 0.6354 0.3734 将求得的解代回原方程,可以检验结果是否正确,命令如下: q=myfun(x) q = 1.0e-009 * 0.2375?0.2957 可见得到了较高精度的结果。 cite from:http://blog.sina.com.cn/s/blog_56ef652d0100ebew.html 4、fsolve函数解方程 [X,FVAL,EXITFLAG,OUTPUT,JACOB]=FSOLVE(FUN,X0,...) returns the Jacobian of FUN at X. Examples FUN can be specified using @: x = fsolve(@myfun,[2 3 4],optimset('Display','iter')) where myfun is a MATLAB function such as: function F = myfun(x) F = sin(x); FUN can also be an anonymous function: x = fsolve(@(x) sin(3*x),[1 4],optimset('Display','off')) If FUN is parameterized, you can use anonymous functions to capture the problem-dependent parameters. Suppose you want to solve the system of nonlinear equations given in the function myfun, which is parameterized by its second argument c. Here myfun is an M-file function such as function F = myfun(x,c) F = [ 2*x(1) - x(2) - exp(c*x(1)) -x(1) + 2*x(2) - exp(c*x(2))]; To solve the system of equations for a specific value of c, first assign the value to c. Then create a one-argument anonymous function that captures that value of c and calls myfun with two arguments. Finally, pass this anonymous function to FSOLVE: c = -1; % define parameter first x = fsolve(@(x) myfun(x,c),[-5;-5]) 发自小木虫Android客户端 |
11楼2016-11-02 08:27:50
2楼2016-11-01 23:10:43
yibaka
新虫 (正式写手)
- 应助: 0 (幼儿园)
- 金币: 3726.7
- 散金: 21
- 红花: 2
- 帖子: 588
- 在线: 101小时
- 虫号: 3234576
- 注册: 2014-05-26
- 专业: 几何学
3楼2016-11-01 23:39:51
往前一步走
新虫 (小有名气)
- 应助: 0 (幼儿园)
- 金币: 2082.7
- 散金: 10
- 帖子: 91
- 在线: 17小时
- 虫号: 3608082
- 注册: 2014-12-23
- 性别: GG
- 专业: 计算机科学的基础理论
4楼2016-11-02 00:10:53













回复此楼
picklas