简体   繁体   中英

How do I split my array from [x0+y0 x1+y1] to [x0 x1] and [y0 y1]?

I have an array of [x0+y0 X1+y1... xi+yi]

The x a real number and y is an imaginary number, represented as y*j

My goal is to split the array into two arrays, one with the real numbers of x only, and the other of y only.

My secondary goal is to keep the original array and convert the numbers from reflection coefficient to impedance, like the matlab function gamma2z(gamma,z0) .

gamma2z(gamma, z0) takes the Zs (Rs+jXs) and converts to Gamma (MAG ANG)

I've used numpy to try and iterate over the array to split it up but I'm not sure on a good solution.

## take z magnitude as measured by a vi probe and convert to z impedance
vizmag = list(map(float, vizmag))  # list to array
vizmag_array = np.array(vizmag)
zi_array = vizmag_array * np.sin(vizphase_array)
z_array = zr_array + (1j * zi_array)

Example of the first few numbers in the z_array:

[ 36.00156638-40.66947803j  28.65855539-32.95743965j 46.53282834-49.22257188j 
  24.02429746-26.01756523j  37.97779293-38.56426933j 30.61459941-31.62382849j ]

Once this is working correctly, in the end I will take the data to plot a Smith Chart. Any help would be appreciated. Thanks

I'm not sure if this is what youa re asking but numpy has already built in functions to extract real and imaginary parts of lists. try looking up numpy.imag and numpy.real

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM