【问题标题】:how to get the roots of x using newton raphson method in matlab [closed]如何在matlab中使用newton raphson方法获得x的根[关闭]
【发布时间】:2012-09-30 01:19:04
【问题描述】:
a=2

b=3

c=7

d=5

w=14

在matlab中使用newton raphson方法求x

enter code here
4.w.d^2.(1-x^2)^2=a.b.c^3.x.sqrt(pi^2.(1-x^2)^2+16.x^2)

【问题讨论】:

  • 我非常非常怀疑这需要一个“作业”标签。另外,你试过什么?你有什么具体问题?我们不是来帮你编码的,我们是来帮你的。
  • 而不是给予 -1 和进一步的反对票。请将此问题迁移至math.stackexchange.com。我没有那个特权。
  • @Yavar:这在很大程度上是一个 Matlab 问题,而且是一个糟糕的公式化问题。我认为 math.stackexchange.com 不会对这个问题感兴趣,也不认为答案对 OP 有用。
  • @jonas:你是绝对正确的,我认为当问题发布时,主题中没有 matlab,所以这样评论。

标签: matlab


【解决方案1】:

类似的帖子,甚至在 StackOverflow 上,如 this onethis one。更多在网络上,如Matlab Central,或其他教育网站,如here。所以,我认为你本可以更充分地准备好。就我最喜欢的方法而言,我会在这里投入两分钱。

function x = newton(f,dfdx,x0,tolerance)
err = Inf;
x = x0;
while abs(err) > tolerance
   xPrev = x;
   x = xPrev - f(xPrev)./dfdx(xPrev);
   % stop criterion: (f(x) - 0) < tolerance
   err = f(x); % 
   % stop criterion: change of x < tolerance
   % err = x - xPrev;
end

f = @(x) ((x-4).^2-4);
dfdx = @(x)(2.*(x-4));
x0 = 1;
xRoot = newton(@f,@dfdx,x0,1e-10);

f(x) = 4wd2(1-x2)2 - abc3x√ (π2*(1-x2)2+16*x2)

因此,只需将上述等式与 x 进行微分,就可以得到 df/dx。将方程插入文件句柄并运行例程!另外,我可以将其移至 SE Math,但我也不知道该怎么做。 :-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-23
    • 2014-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多