هذي حقت الثانيه أخذتها من طالب :
' Hall-Yarborough method
If cmb1.Text = ("Hall-Yarborough") Then
t = 1 / tpr
Dim y As Double
Dim yn As Double
r = 1
y = 0.0125 * ppr * t * Exp(-0.12 * ((1 - t) ^ 2))
Do Until r <= 0.00001
aa = -0.06125 * ppr * t * Exp(-1.2 * ((1 - t) ^ 2))
ab = (y + (y ^ 2) + (y ^ 3) + (y ^ 4)) / ((1 - y) ^ 3)
ac = (y ^ 2) * ((14.76 * t) - (9.76 * (t ^ 2)) + (4.58 * (t ^ 3)))
os = (2.18 + (2.82 * t))
ad = (y ^ os) * ((90.7 * t) - (242.2 * (t ^ 2) + (42.4 * (t ^ 3))))
fy = aa + ab - ac + ad
ba = (1 + (4 * y) + (4 * (y ^ 2)) - (4 * (y ^ 3)) - (y ^ 4)) / ((1 - y) ^ 4)
bb = ((29.52 * t) - (19.52 * (t ^ 2)) + (9.16 * (t ^ 3))) * y
bc = (2.18 + 2.82 * t) * (y ^ (1.18 + (2.82 * t))) * ((90.7 * t) - (242.2 * (t ^ 2) + (42.4 * (t ^ 3))))
dfy = ba - bb + bc
yn = y - (fy / dfy)
r = Abs((yn ^ 2) - (y ^ 2))
y = yn
Loop
Zh = ((0.06125 * ppr * t / y) * Exp(-1.2 * (1 - t) ^ 2))
txtan2 = Zh
Do Until p < 0
Cells(10 + i, 17) = p
Cells(10 + i, 18) = Zh
p = p - 50
ppr = p / pcc
Zh = ((0.06125 * ppr * t / y) * Exp(-1.2 * (1 - t) ^ 2))
i = i + 1
Loop
Set CurrentChart = Sheets("Charts").ChartObjects(1).Chart
CurrentChart.Parent.Width = 426
CurrentChart.Parent.Height = 252
' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Show the chart
img1.Picture = LoadPicture(Fname)
End If