c******k 发帖数: 1140 | 1 -a*c*log(exp(-pi/(a*d))+exp(pi/(a*d)))+c*pi/d=0
其中
c=3.0e+8
d=345e-9
a的初始值在5.5e+5附近,但是用Matlab的fzero解这个单变量非线性方程,总是报如下
错误:
??? Error using ==> fzero
Function value at starting guess must be finite and real.
Error in ==> D:\NewData\Re-visite PBG Curve\FsolvePBGFun.m
On line 44 ==> x=fzero(inline('-x*(3.0e+8)*log(exp(-pi/(x*(345e-9))+exp(pi/
(x*(345e-9)))))+(3.0e+8)*pi/(345e-9)'),x0,options);
a=5.5e+5的初始值,难道不是finite and real吗?换其它值也报错,怎么回事,谢谢
了 |
l*****i 发帖数: 3929 | 2 拜托请rescale一下你的方程,都出现e+17的系数了
pi/
【在 c******k 的大作中提到】 : -a*c*log(exp(-pi/(a*d))+exp(pi/(a*d)))+c*pi/d=0 : 其中 : c=3.0e+8 : d=345e-9 : a的初始值在5.5e+5附近,但是用Matlab的fzero解这个单变量非线性方程,总是报如下 : 错误: : ??? Error using ==> fzero : Function value at starting guess must be finite and real. : Error in ==> D:\NewData\Re-visite PBG Curve\FsolvePBGFun.m : On line 44 ==> x=fzero(inline('-x*(3.0e+8)*log(exp(-pi/(x*(345e-9))+exp(pi/
|
c******k 发帖数: 1140 | 3 如何调整,c 和 d 就是差别特别大
【在 l*****i 的大作中提到】 : 拜托请rescale一下你的方程,都出现e+17的系数了 : : pi/
|
l*****i 发帖数: 3929 | 4 at least... divide both sides of your equation by c...
【在 c******k 的大作中提到】 : 如何调整,c 和 d 就是差别特别大
|
l*****i 发帖数: 3929 | 5 If you divide c on both sides of your equation, and do some simple math, reg
ard y=pi/(d*a), you will get a very simple equation:
log(exp(-y)+exp(y))-y = 0
Isn't this a very nicely scaled equation in y? Solve it using fzero you get
y = 20.48, then
a = pi/(20.48*d) = 4.4463e+5.
pi/
【在 c******k 的大作中提到】 : -a*c*log(exp(-pi/(a*d))+exp(pi/(a*d)))+c*pi/d=0 : 其中 : c=3.0e+8 : d=345e-9 : a的初始值在5.5e+5附近,但是用Matlab的fzero解这个单变量非线性方程,总是报如下 : 错误: : ??? Error using ==> fzero : Function value at starting guess must be finite and real. : Error in ==> D:\NewData\Re-visite PBG Curve\FsolvePBGFun.m : On line 44 ==> x=fzero(inline('-x*(3.0e+8)*log(exp(-pi/(x*(345e-9))+exp(pi/
|
c******k 发帖数: 1140 | 6 太感谢了,我咋这么笨呢
reg
get
【在 l*****i 的大作中提到】 : If you divide c on both sides of your equation, and do some simple math, reg : ard y=pi/(d*a), you will get a very simple equation: : log(exp(-y)+exp(y))-y = 0 : Isn't this a very nicely scaled equation in y? Solve it using fzero you get : y = 20.48, then : a = pi/(20.48*d) = 4.4463e+5. : : pi/
|
l*****i 发帖数: 3929 | 7 just found another thing: how did you get such a strange equation? If you do
what I told you to do, you get the equation in y, but it is equivalent to
exp(-y)+exp(y) = exp(y)
which does not have a solution at all! I suspect something in your original
equation was wrong...
【在 c******k 的大作中提到】 : 太感谢了,我咋这么笨呢 : : reg : get
|
c******k 发帖数: 1140 | 8 I already found this problem either. The good thing is that you give a hint
how to solve this kind of nonlinear equation. Actually I need solve two
nonlinear equations in one group, and there is another parameter b in the
above equation. For simplicity, I just let b=0.
do
original
【在 l*****i 的大作中提到】 : just found another thing: how did you get such a strange equation? If you do : what I told you to do, you get the equation in y, but it is equivalent to : exp(-y)+exp(y) = exp(y) : which does not have a solution at all! I suspect something in your original : equation was wrong...
|
l*****i 发帖数: 3929 | 9 all right, good luck then
hint
you
to
【在 c******k 的大作中提到】 : I already found this problem either. The good thing is that you give a hint : how to solve this kind of nonlinear equation. Actually I need solve two : nonlinear equations in one group, and there is another parameter b in the : above equation. For simplicity, I just let b=0. : : do : original
|