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 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******h 发帖数: 29 | 3 在编一个matlab m file, 想用fzero找到一个函数靠近5的零点,
fzero( inline(' f(x) '),5 ),
但是f(x)必须用到这之前命令算出来的数组q,q里的数据是在运行过程中得出的,所以
没法代入函数, 问题是怎样让fzero算出f(x)的零点。。
恳请各位指教。。多谢!! |
|
l******h 发帖数: 29 | 4 在编一个matlab m file, 想用fzero找到一个函数靠近5的零点,
fzero( inline(' f(x) '),5 ),
但是f(x)必须用到这之前命令算出来的数组q,q里的数据是在运行过程中得出的,所以
没法代入函数, 问题是怎样让fzero算出f(x)的零点。。
恳请各位指教。。多谢!! |
|
l*****y 发帖数: 32 | 5 x = fzero(fun,x0) tries to find a zero of fun near x0, if x0 is a scalar.
在计算中,我怎么知道x0该怎么选取啊? |
|
l*****i 发帖数: 3929 | 6 拜托请rescale一下你的方程,都出现e+17的系数了
pi/ |
|
|
l*****i 发帖数: 3929 | 8 at least... divide both sides of your equation by c... |
|
|
l*****i 发帖数: 3929 | 10 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 发帖数: 1140 | 11 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 发帖数: 3929 | 12 all right, good luck then
hint
you
to |
|
y*********u 发帖数: 80 | 13 多谢各位了。
我试图用matlab的fzero命令来求,但是因为f(x)=0有多解,所以在给定初始值的问题
上比较麻烦。从上面的讨论看来,似乎没有什么简单的办法。难道还是用笨笨的办法,
给定较小步长,一个一个的试验了?再次多谢各位的讨论! |
|
r*g 发帖数: 3159 | 14 不用重新写轮子。
1.155370825100078 < x < 26.093485476611910
(from matlab : fzero(@(x) 8*log(x) - x, 1 或 30)) |
|
f****e 发帖数: 590 | 15 search B-S implied volatility用什么算法比较好?
在matlab里面用什么函数比较合适呢?
我用fzero,但在搜寻过程中经常会search 到负数那边,虽然结果没问题
但是觉得效率不高
各位有什么更好的办法?
谢谢! |
|