US English (US)
JP Japanese
CN Chinese
KR Korean

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Knowledge Base Home
  • Contact Us
Chinese
US English (US)
JP Japanese
CN Chinese
KR Korean
  • Home
  • 频率响应分析仪

使用Moku:Go测量阻抗(第 1 部分)

使用Moku :go 和 Python 测量电阻

Written by Paul Cracknell

Updated at April 7th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Moku:Lab
    Moku:Lab逻辑分析仪/码型发生器 Moku:Lab时间间隔与频率分析仪 Moku:Lab频谱分析仪 Moku:Lab PID 控制器 Moku:Lab示波器 Moku:Lab激光锁频/稳频器 Moku:Lab相位表 Moku:Lab数字滤波器 Moku:Lab任意波形发生器 Moku:Lab波形发生器 Moku:Lab频率响应分析仪 Moku:Lab FIR 滤波器生成器 Moku:Lab锁相放大器 Moku:Lab常见问题解答 Moku:Lab数据记录器
  • Moku:Go
    Moku:Go锁相放大器 Moku:Go逻辑分析仪和码型发生器 Moku:Go示波器和电压表 Moku:Go频谱分析仪 Moku:Go波形发生器 Moku:Go时间间隔与频率分析仪 Moku:Go数字滤波器 Moku:Go FIR 滤波器生成器 Moku:Go激光锁频/稳频器 Moku:Go任意波形发生器 Moku:Go频率响应分析仪 Moku:Go数据记录器 Moku:Go常见问题解答 Moku:Go相位表 Moku:Go电源 Moku:Go PID 控制器
  • Moku:Pro
    Moku:Pro波形发生器 Moku:Pro时间间隔与频率分析仪 Moku:Pro逻辑分析仪/码型发生器 Moku:Pro激光锁频/稳频器 Moku:Pro锁相放大器 Moku:Pro频谱分析仪 Moku:Pro数据记录器 Moku:Pro任意波形发生器 Moku:Pro多仪器并行模式 Moku:Pro相位表 Moku:Pro FIR 滤波器生成器 Moku:Pro PID 控制器 Moku:Pro示波器 Moku:Pro频率响应分析仪 Moku:Pro常见问题解答 Moku:Pro数字滤波器
  • Python API
  • MATLAB API
  • 任意波形发生器
  • 数据记录器
  • 数字滤波器
  • FIR滤波器生成器
  • 频率响应分析仪
  • 激光锁频/稳频器
  • 锁相放大器
  • 示波器
  • 相位表
  • PID 控制器
  • 频谱分析仪
  • 时间间隔与频率分析仪
  • 波形发生器
  • 逻辑分析仪/码型发生器
  • 多仪器并行模式
  • Moku云编译
  • Moku常见问题解答
  • LabVIEW API
+ More

这两个 Python 脚本附带应用说明“ 使用Moku:Go测量阻抗,第 1 部分,电阻”。

单端口方法

# moku example: Single-Port Impedance Test
#
# This example demonstrates how you can take an impedance of a device under
# test using the single-port method
#

# Initializing the Instrument and Functions
from moku.instruments import FrequencyResponseAnalyzer
import numpy as np
import math

# Connect to your Moku by its ip address using FrequencyResponseAnalyzer('192.168.###.###')
# or by its serial number using FrequencyResponseAnalyzer(serial=123)
i = FrequencyResponseAnalyzer('192.168.73.1', force_connect=True)

try:
    
   # Configure Input Parameters
    i.set_output(1, 1)
    i.measurement_mode('In')
    
    # For Moku:Go
    i.set_frontend(1, "50Ohm", "DC", "10Vpp")
    
    # For Moku:Lab and Moku:Pro 
    #i.set_frontend(1, "50Ohm", "DC", "4Vpp")
    
    
     # Configure output sweep parameters
    i.set_sweep(start_frequency=6e4, stop_frequency=100, num_points=256,
                averaging_time=1e-6, settling_time=1e-6, averaging_cycles=1, settling_cycles=1)
    
    # Check the parameters of the FRA 
    print(i.summary())

    # Start the sweep 
    i.start_sweep(single=True)

    # Get a single sweep frame. This will block until the sweep is complete,
    # beware if you include low frequencies there will be a longer
    # measurement time for the frame
    
    frame = i.get_data()

    # Known  
    # Input Impedance for the Moku:Lab and Moku:Pro
    # For Moku:Go, this is the parallel resistance with a 50 ohm 
    # terminator resistor in parallel with the input
    Z_in = 50 #ohms 
    
    # Amplitude of the Output Voltage from the FRA
    V_out = 1 #Vpp
    
    
    # Output Impedance of the Moku
    # Make sure the correct one is put into your equation below
    Z_out_Go = 200 #ohms
    Z_out_Pro_Lab = 50 #ohms
    
    
    
    #Taking needed Power Measurement
    frequency = frame['ch1']['frequency']
    magnitude = frame['ch1']['magnitude']
    
    
    
    
    # Check Outputs
    #print(frame['ch1']['magnitude'])
    #print(frame['ch1']['frequency'])

    
    # Pull the Power Measurement at the Frequency of 300 Hz
    index_300hz = np.argmin(np.abs(np.array(frequency) - 300))
    dBm = magnitude[index_300hz]
    

    # Assuming Moku is expressing the dBm
    V_in = math.sqrt(8 * Z_in * ((10 ** (dBm / 10)) / 1000))

    print(f"The magnitude at 300 Hz is {dBm:.2f} dBm, which corresponds to {V_in:.4f} V.")
    
    
    # Calculate Z_DUT
    # Make sure the correct Z_out is being used
    Z_dut = ((V_out * Z_in) / V_in) - (Z_in + Z_out_Go)
    print(f"The impedance of the device under test is: {Z_dut:.2f} Ohms")
    
except Exception as e:
    print(f'Exception occurred: {e}')
finally:
    # Close the connection to the Moku device
    # This ensures network resources and released correctly
    i.relinquish_ownership()

双端口方法

# moku example: Two-Port Impedance Test
#
# This example demonstrates how you can take an impedance of a device under
# test using the two-port method
#

#
from moku.instruments import FrequencyResponseAnalyzer
import numpy as np
import math

# Connect to your Moku by its ip address using FrequencyResponseAnalyzer('192.168.###.###')
# or by its serial number using FrequencyResponseAnalyzer(serial=123)
i = FrequencyResponseAnalyzer('192.168.73.1', force_connect=True)

try:

    # Configure output sweep amplitudes
    # Channel 1 - 1Vpp
    i.set_output(1, 1)

    # Configure output sweep parameters

    i.measurement_mode('In')
    i.set_sweep(start_frequency=10e4, stop_frequency=100, num_points=256,
                averaging_time=1e-6, averaging_cycles=1, settling_cycles=1,
                settling_time=1e-6)
    
    
     # For Moku:Go
    i.set_frontend(1, "50Ohm", "DC", "10Vpp")
    
    # For Moku:Lab and Moku:Pro 
    #i.set_frontend(1, "50Ohm", "DC", "4Vpp")

    
    # Start the single sweep
    i.start_sweep(single=True)

    # Get a single sweep frame. This will block until the sweep is complete,
    # beware if your range includes low frequencies!
    frame = i.get_data()
    

    # Known 
    # Note that Z_in will vary for Moku:Go based on the parallel resistance
    Z_in= 50 #ohms
    V_out = 1 #Vpp
    

    # Check the parameters of the FRA 
    print(i.summary())
    
    
    # Taking Power Measurement at 300 Hz from Input 1 and Input 2
    frequency_1 = frame['ch1']['frequency']
    magnitude_1 = frame['ch1']['magnitude']
    index_1_300hz = np.argmin(np.abs(np.array(frequency_1) - 300))
    magnitude_300hz_ch1 = magnitude_1[index_1_300hz]
    
    frequency_2 = frame['ch2']['frequency']
    magnitude_2 = frame['ch2']['magnitude']
    index_2_300hz = np.argmin(np.abs(np.array(frequency_2) - 300))
    magnitude_300hz_ch2 = magnitude_2[index_2_300hz]

    
    # Print the corresponding magnitude values at the desired frequency
    print(f"The magnitude of channel 1 at 300 Hz is: {magnitude_300hz_ch1:.4f} dBm")
    print (f"The magnitude of channel 2 at 300 Hz is: {magnitude_300hz_ch2:.4f} dBm")
    
    # Convert magnitudes from dBm to linear scale
    linear_magnitude_1 = 10 ** (magnitude_300hz_ch1 / 10)
    linear_magnitude_2 = 10 ** (magnitude_300hz_ch2/ 10)

    # Take the ratio of Channel 2 to Channel 1 
    linear_result = linear_magnitude_2 / linear_magnitude_1

    # Convert linear result back to dBm
    result_dB = 10 * np.log10(linear_result)


    # Print result (Ch2/Ch1)
    print(f"Channel 2 divided by Channel 1 results in: {result_dB:.4f} dBm")

    
    # Use the power ratio to calculate the impedance of your device under test 
    x = 10**(result_dB/10)
    power_ratio= np.sqrt(x)
    Z_dut = (power_ratio*Z_in)-Z_in
    print(f"The impedance of the device under test is: {Z_dut:.2f} Ohms")
    

except Exception as e:
    print(f'Exception occurred: {e}')
finally:
    # Close the connection to the Moku device
    # This ensures network resources and released correctly
    i.relinquish_ownership()
    

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • 如何使用Moku频率响应分析仪绘制输入 1 和输入 2 的比率?
  • 如何从我的Moku导出测量数据?
  • Moku可以进行相位展开解调吗
  • 使用频率响应分析仪测量阻抗(电感)
  • 动态幅度调整

Sitemap

  • Moku:Lab
  • Instruments
  • Software
  • Company
  • Support
  • Store
  • Terms & Conditions
  • Privacy Policy

Offices

United States
+1 (619) 332-6230
12526 High Bluff Dr
Suite 150
San Diego, CA 92130

Australia
+61 2 6171 9730
243 Northbourne Avenue
Suite 2
Lyneham, ACT 2602

Australia
+61 03 7073 3594
700 Swanston Street
Suite 5E, Level 5
Carlton, VIC 3053

Follow us

Youtube LinkedIn

官方微信

Contact us
© 2025 Liquid Instruments. All rights reserved.

Knowledge Base Software powered by Helpjuice

Definition by Author

0
0
Expand