w0407010322 发表于 2008-5-13 17:39

VB编程问题

我毕业设计要用CST软件设计仿真一个天线,在建模的时候遇到一个问题,要对一个曲面建构进行建模,这个曲面遵循一个指数函数y=e 0.0279z (其中0.0279z是指数),该软件建模曲面要用vb编程,它可直接生成一个自定义曲线,然后改写它的程序,就可以生成自己想要的曲线,下面是它的原程序,请问该怎么编程才能生成我想要的y=e 0.0279z (其中0.0279z是指数)?
On Error GoTo Curve_Exists
        Curve.NewCurve "2D-Analytical"
Curve_Exists:
On Error GoTo 0

Dim sCurveName As String

sCurveName = "spline_1"

With Spline
  .Reset
  .Name sCurveName
  .Curve "2D-Analytical"
' ======================================
' !!! Do not change ABOVE this line !!!
' ======================================
' -----------------------------------------------------------
' adjust x-range as for-loop parameters (xmin,max,stepsize)
' enter y-Function-statement within for-loop
' fixed parameters a,b,c have to be declared via Dim-Statement
' -----------------------------------------------------------
' NOTE: available MWS-Parameters can be used without
'       declaration at any place (loop-dimensions, ...)
'       (for parametric curves during parameter-sweeps and optimisation !)
' -------------------------------------------
  Dim xxx As Double, yyy As Double
  
  Dim aaa As Double  ' not necessary if aaa is model parameter
  aaa = 1.23456/Atn(0.5)

  For xxx = 1.5  To  10  STEP  0.5

        yyy = 3*aaa/xxx + Sin(xxx^2)
               
        .LineTo xxx , yyy
  Next xxx
' ======================================
' !!! Do not change BELOW this line !!!
' ======================================
  .Create
End With

SelectTreeItem("Curves\2D-Analytical\"+sCurveName)


页: [1]

编程论坛