dim bMarch as boolean
Rumr=Rmin
DR=0.000001'假设
do while Rumr<=Rmax
Zi=f(Rumr)
if abs(Rumr -g(zi))<Err then
bMarch =true
exit do
end if
Rumr=Rumr+DR
loop
if bmarch then
msgbox "解为Z=“&cstr(z)& "Rumr="&cstr(Rumr)
else
msgbox "在。。。范围内,没有找到有效解"
end if
简单的做法
假设两个函数为 Z=f(Rumr) 和 Rumr=g(Z)
假设Rumr可能的值范围为 Rmin-Rmax 假设一个允许的误差 Err 假设分辨率为DR
dim bMarch as boolean
Rumr=Rmin
DR=0.000001'假设
do
Zi=f(Rumr)
if abs(Rumr -g(zi))<Err then
bMarch =true
exit do
end if
Rumr=Rumr+DR
loop
if bmarch then
msgbox "解为Z=“&cstr(z)& "Rumr="&cstr(Rumr)
else
msgbox "在。。。范围内,没有找到有效解"
end if