how to write a code for 10db bandwidth calculation in CST

Status
Not open for further replies.

ehsanzf

Newbie
Joined
Feb 1, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
hello dear friends,
I have simulated a structure in CST and I'm trying to optimize it by writing the optimization codes in Macros of the software. the problem I have faced is that how can I write the code for calculation of bandwidth for the plot like the one below. I Want the 10dB bandwidth of the of between points 3 & 4. I cannot limit my frequency sweep because this band shifts to other frequencies while optimization. The code I have used for is the this:

Code:
  f1 = mfmin
    temps1 = Abs(ms11min-threshold)
    f2 = mfmin
    temps2 = Abs(ms11min-threshold)
    For i = 0 To nn-1
      If mfreq(nn-1-i) < mfmin Then
        If Abs(ms11(nn-1-i)-threshold) < temps1 Then
          f1 = mfreq(nn-1-i)
          temps1 = Abs(ms11(nn-1-i)-threshold)
        End If
      End If
      If mfreq(i) > mfmin Then
        If Abs(ms11(i)-threshold) < temps2 Then
          f2 = mfreq(i)
          temps2 = Abs(ms11(i)-threshold)
        End If
      End If
    Next i


the problem is that it sometimes calculate the other 10dB bandwidth between 1&2 or the bandwidth between 1 & 4!
Thank you.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…