24小时热门版块排行榜    

查看: 1887  |  回复: 14

dengwei_19

木虫 (著名写手)

铁齿金不换诚实可靠小郎君

[求助] 现在做到高斯函数的误差函数一步,又是一个方程不知道用matlab怎么写

求w,求详解!谢谢!!!
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
回帖支持 ( 显示支持度最高的前 50 名 )

dbb627

荣誉版主 (著名写手)


dengwei_19: 回帖置顶 2012-04-13 15:38:54
引用回帖:
9楼: Originally posted by dengwei_19 at 2012-04-13 15:07:09:
>>  fun=@(x)-5.4*(pi^(1/2)*erf(10*2^0.5./x))/2-2.8*(pi^(1/2)*erf(40*2^0.5./x))/2+2.6;
x=0.1:0.1:100;
y=feval(fun,x);
plot(x,y)
=fsolve(fun,80)
这个能详解下过程吗?

fun=@(x)-5.4*(pi^(1/2)*erf(10*2^0.5./x))/2-2.8*(pi^(1/2)*erf(40*2^0.5./x))/2+2.6;
这个是将你的积分方程式转为误差函数,-(pi^(1/2)*erf(10*2^0.5./x))/2(pi^(1/2)*erf(40*2^0.5./x))/2,是你的两个积分
w(即x)的解使得fun=0
x=0.1:0.1:100;
y=feval(fun,x);
plot(x,y)
这个是w(即x)在0到100之间变化时fun的取值,用来在做图猜测w大概在什么位置,fun=0
[x,feval,flag]=fsolve(fun,80)是用来求精确数值解

x解即w
feval 取x的值 fun的函数值越接近0越好
flag 判断解的情况
1  FSOLVE converged to a root.
      2  Change in X too small.
      3  Change in residual norm too small.
      4  Computed search direction too small.
      0  Too many function evaluations or iterations.
     -1  Stopped by output/plot function.
     -2  Converged to a point that is not a root.
     -3  Trust region radius too small (Trust-region-dogleg) or
         Regularization parameter too large (Levenberg-Marquardt).
     -4  Line search failed.

» 本帖已获得的红花(最新10朵)

The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
11楼2012-04-13 15:23:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通回帖

onesupeng

金虫 (职业作家)

【答案】应助回帖

感谢参与,应助指数 +1
这个matlab有点悬吧?我觉得自己编程序算恐怕更好呢
长期招收博士生,参见http://fsl-unsw.com
2楼2012-04-13 13:47:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dengwei_19

木虫 (著名写手)

铁齿金不换诚实可靠小郎君

引用回帖:
2楼: Originally posted by onesupeng at 2012-04-13 13:47:46:
这个matlab有点悬吧?我觉得自己编程序算恐怕更好呢

不会吧。。。。。没办法求吗?
3楼2012-04-13 13:53:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
dengwei_19: 金币+6, ★★★很有帮助 2012-04-13 14:36:22
dengwei_19: 回帖置顶 2012-04-13 15:40:01
>> syms x
>> syms w;int(exp(-x^2),0,w)

ans =

(pi^(1/2)*erf(w))/2

>> syms w;int(exp(-x^2),0,-w)

ans =

-(pi^(1/2)*erf(w))/2
===========
>> fun=@(x)-5.4*(pi^(1/2)*erf(10*2^0.5./x))/2-2.8*(pi^(1/2)*erf(40*2^0.5./x))/2+2.6;
>> x=0.1:0.1:100;
>> y=feval(fun,x);
>> plot(x,y)
>> [x,feval,flag]=fsolve(fun,80)

Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.




x =

   81.4787


feval =

-9.0775e-010


flag =

     1

» 本帖已获得的红花(最新10朵)

The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2012-04-13 14:19:25
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dingd

铁杆木虫 (职业作家)

【答案】应助回帖

感谢参与,应助指数 +1
不知道你的公式是否正确,没有正确的实数解,如果右边是2.6,到有一个解:
w: -0.280599708910106
5楼2012-04-13 14:34:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dengwei_19

木虫 (著名写手)

铁齿金不换诚实可靠小郎君

引用回帖:
4楼: Originally posted by dbb627 at 2012-04-13 14:19:25:
>> syms x
>> syms w;int(exp(-x^2),0,w)

ans =

(pi^(1/2)*erf(w))/2

>> syms w;int(exp(-x^2),0,-w)

ans =

-(pi^(1/2)*erf(w))/2
===========
>> fun=@(x)-5.4* ...

x =

   81.4787

这个是解出来的w吗?
6楼2012-04-13 14:39:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★
dengwei_19: 金币+4, ★★★★★最佳答案 2012-04-13 14:49:55
dengwei_19: 回帖置顶 2012-04-13 15:17:11
引用回帖:
6楼: Originally posted by dengwei_19 at 2012-04-13 14:39:24:
x =

   81.4787

这个是解出来的w吗?

是的,这个就是matlab求出的数值解,做图也可以看出来在80附近。
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
7楼2012-04-13 14:43:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dengwei_19

木虫 (著名写手)

铁齿金不换诚实可靠小郎君

引用回帖:
7楼: Originally posted by dbb627 at 2012-04-13 14:43:37:
是的,这个就是matlab求出的数值解,做图也可以看出来在80附近。

学到很多东西 这个程序我好好看看 有不懂的语句再请教!非常感谢!!!!
8楼2012-04-13 14:49:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dengwei_19

木虫 (著名写手)

铁齿金不换诚实可靠小郎君

引用回帖:
7楼: Originally posted by dbb627 at 2012-04-13 14:43:37:
是的,这个就是matlab求出的数值解,做图也可以看出来在80附近。

>>  fun=@(x)-5.4*(pi^(1/2)*erf(10*2^0.5./x))/2-2.8*(pi^(1/2)*erf(40*2^0.5./x))/2+2.6;
x=0.1:0.1:100;
y=feval(fun,x);
plot(x,y)
[x,feval,flag]=fsolve(fun,80)
这个能详解下过程吗?
9楼2012-04-13 15:07:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dengwei_19

木虫 (著名写手)

铁齿金不换诚实可靠小郎君

引用回帖:
7楼: Originally posted by dbb627 at 2012-04-13 14:43:37:
是的,这个就是matlab求出的数值解,做图也可以看出来在80附近。

fun=@(x)-5.4*(pi^(1/2)*erf(10*2^0.5./x))/2-2.8*(pi^(1/2)*erf(40*2^0.5./x))/2+2.6
把方程都移到一边等于函数
x=0.1:0.1:100;  从0.1到100 0.1的增长
y=feval(fun,x);
plot(x,y)
[x,feval,flag]=fsolve(fun,80)  看x为多少是函数为0 ?

基本是这样的思路?
10楼2012-04-13 15:18:58
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 dengwei_19 的主题更新
信息提示
请填处理意见