ty9413 于 2016.05.02 15:03 提问

θ=输入值

S= 输入值

x=0 to 360
e=0.2S
h=1.2S
a=0.7S
X1=a*sin(θ+x)
y1=-a*cos(θ+x)
x2=e
y2=h+S
b= Math.Sqrt((x1 - x2) ^ 2 + (y1 - y2) ^ 2)

θ 和S 文本输入框让用户自定义

1个回答

ty9413   2016.05.02 15:16

vb.NET软件
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Me.TextBox1.Text = "" Then
MsgBox("请输入值", , "提示信息")
Else
Dim l1 As Double 'CB
Dim l2 As Double 'AB
Dim S As Double '从动杆工作行程
Dim a As Double '原动杆0A长度
Dim θ0 As Double '曲柄起始角度
'Dim Q1 As Double '升程运动对应的曲柄转角
' Dim Q2 As Double '最高位置停留对应的曲柄转角
'Dim Q3 As Double '降程运动对应的曲柄转角
'Dim Q4 As Double '最低位置停留对应的曲柄转角
Dim h As Double '滑块最低点到凸轮中心
Dim Ee As Double
Dim XB As Double
Dim XB1 As Double
Dim YB As Double
Dim XD As Double
Dim YD As Double
Dim x As Double
Dim max As Double
Dim min As Double
Dim J As Integer
Dim K As Double
Dim u As Double
Dim v As Double
Dim i As Double
Dim θ(0 To 360) As Double
For x = 1 To 360

``````            S = Me.TextBox1.Text
a = S * 0.7             '曲柄AB
h = S * 1.2
Ee = Me.TextBox3.Text
θ0 = Me.TextBox4.Text
XB = a * Math.Sin(θ0 + x)
YB = -a * Math.Cos(θ0 + x)
XD = Ee
YD = h + S
θ(x) = Math.Sqrt((XB - XD) ^ 2 + (YB - YD) ^ 2)
Next x
For i = 2 To 360
If θ(i) > max Then max = θ(i)
K = YB
J = XB

Next i
u = Math.Asin(J / a) * (360 / (2 * Math.PI))

For x = 1 To 360

S = Me.TextBox1.Text
a = S * 0.7             '曲柄AB
h = S * 1.2
Ee = Me.TextBox3.Text
θ0 = Me.TextBox4.Text
XB1 = a * Math.Sin(θ0 + x)
YB = -a * Math.Cos(θ0 + x)
XD = Ee
YD = h + S
θ(x) = Math.Sqrt((XB1 - XD) ^ 2 + (YB - YD) ^ 2)
Next x
min = θ(1)

For i = 2 To 360
If θ(i) < min Then min = θ(i)

Next i

'Q1 = Me.TextBox5.Text
'Q2 = Me.TextBox6.Text
' Q3 = Me.TextBox7.Text
'Q4 = Me.TextBox8.Text
l1 = (max + min) / 2
l2 = (max - min) / 2

v = Math.Asin(0.5) * (360 / (2 * Math.PI))

Me.Label6.Text = "铰销D至轴的最小距离=" & h
Me.Label7.Text = "曲柄AB=" & a
Me.Label8.Text = "曲柄起始角度=" & θ0
Me.Label9.Text = "偏心距离=" & Ee
Me.Label10.Text = "fmax=" & Format(max, "##.00")
Me.Label11.Text = "fmin=" & Format(min, "##.00")
Me.Label12.Text = "杆CD=" & Format(l1, "##.00")
Me.Label17.Text = "杆AB=" & Format(l2, "##.00")
Me.Label18.Text = "度" & u& v

End If

End Sub

我自己弄的，但是值不对
``````

vb.net 2010下求最大值、最小值及两种排序方法

// 计算浮点数组最大值和最小值float CXXXDlg::Max(float x, float y){ if ( x > y ) {  return x; } else  {  return y; }}float CXXXDlg::ArrayMax(float a[], int n){ float maxa; if ( n==1 )  {  return Max( a[0], a[1] )

function shuzu(arr){  var sum=0;   for(var i=0;i { for(var j=0;j { sum+=arr[i][j]; } } var avg=sum/12; alert('平均值'+avg); } function max(arr){ var max=arr[0][0] for(var i=0;i { for(var
java之数组求最大值与最小值
public class test6{ public static void main(String[] args){ //定义一个数组 int[] array={2,4,234,24,91,45}; int maxvalue=maxvalue(array); System.out.println("最大值是："+maxvalue); } //定义一个选举最大值得方法
vb随机生成十个数并求出最大值
Private Function max(a() As Integer) As Integer Dim i As Integer Dim maxa As Integer For i = LBound(a) To UBound(a) If a(i) > maxa Then maxa = a(i) max = maxa End If Next i End Function Priv
sql server求分组最大值，最小值，最大值对应时间，和最小值对应时间

NumPy常用函数（5）-- 寻找最大值和最小值,以及计算数组的取值范围
通常，我们不仅想知道一组数据的平均值，还希望知道数据的极值以及完整的取值范围——最大值和最小值。    Numpy中min函数和max函数可以计算出最小值和最大值；ptp函数可以计算数组的取值范围，即该函数返回的是数组元素的最大值和最小值直接的差值（max(array) - min(array)）。    最大值/最小值和取值范围实例：from numpy import * h,l=lo...