完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨伙计们,我正在通过GPIB编程PNA,以便在matlab中以矢量形式获取S21参数。
到目前为止,我的一切工作正常,但我想看看是否有可能改善采集时间的持续时间。 这里是我的matlab脚本:fprintf(gpib_port,'INItiate:CONTinuous OFF'); fprintf中(gpib_port, '发起:即时; *纬'); fprintf(gpib_port,'FORM ascii'); fprintf(gpib_port,'CALCulate:DATA?FDATA'); datum(1)= 0; %读取所有vna扫描点并保存在数组中i = 1:1:vna_points vna_data = fscanf(gpib_port,'%c',20); datum(i)= str2double(vna_data); 结束Basicaly,我正在逐个读取每个点,直到通过char得到所有扫描点。 我想知道是否有任何机会做同样的事情,但是将所有跟踪读作字符串而不是多个字符。 显然,从上面看,一旦我增加了扫描点的数量,我就会花更多的时间来读取所有数据。 cheers编辑:joaoreis于2015年1月15日上午7:28 以上来自于谷歌翻译 以下为原文 Hi guys, I am programming a PNA via GPIB to get S21 parameters in form of a vector in matlab. I have everything working ok so far but I want see if it is possible to improve the duration of the aquisition time. here my matlab script: fprintf(gpib_port,'INITiate:CONTinuous OFF'); fprintf(gpib_port,'INITiate:IMMediate;*wai'); fprintf(gpib_port,'FORM ascii'); fprintf(gpib_port,'CALCulate:DATA? FDATA'); datum(1) = 0; % read all vna sweep points and save in a array for i= 1:1:vna_points vna_data = fscanf(gpib_port,'%c',20); datum(i) = str2double(vna_data); end Basicaly, I am reading each point individually until the get all the sweep points through a char. I am wondering if there is any chance to do the same, but read all the trace as a string instead of multiple chars. Obviously from above, as soon as I increase the number of sweep points, I will take more time to read all data. cheers Edited by: joaoreis on Jan 15, 2015 7:28 AM |
|
相关推荐
8个回答
|
|
你看过这个例子:http://www.mathworks.com/help/instrument/examples/characterizing-a-low-noise-amplifier-by-measuring-its-s-parameters.html
以上来自于谷歌翻译 以下为原文 Have you looked at this example: http://www.mathworks.com/help/instrument/examples/characterizing-a-low-noise-amplifier-by-measuring-its-s-parameters.html |
|
|
|
fen556 发表于 2018-10-24 21:02 谢谢,是的,我试过了。 PNA给我:“420-Query Unterminated”当达到给定的例子时:%来自仪器fprintf的请求2端口测量数据(instrObj,'CALC:DATA:SNP:PORTs?'1,2'''); 以上来自于谷歌翻译 以下为原文 Thanks, Yes, I have tried it. PNA give me : "420-Query Unterminated" when it reaches of the given example : % Request 2-port measurement data from instrument fprintf(instrObj, 'CALC:DATA:SNP:PORTs? '1,2'''); |
|
|
|
testd011 发表于 2018-10-24 21:12 您好,虽然我不是自己编写Matlab编程的专家,但我建议您可以查看此消息线程; 你会注意到那里有Matlab代码演示了如何以二进制块形式而不是ASCII传输PNA数据,因为二进制块占用的字节数要少得多,所以它总是最快。 以上来自于谷歌翻译 以下为原文 Hello, although I'm not an expert at Matlab programming myself, I'd suggest you might want to take a look at this message thread; you'll note there is Matlab code there demonstrating how to transfer PNA data in binary block form instead of ASCII, since the binary block takes much fewer total bytes it's always most definitely faster. |
|
|
|
uwyywefwd 发表于 2018-10-24 21:23 嗨,首先感谢您的所有投入。 经过几天的测试,我可以说命令:fprintf(instrObj,'CALC:DATA:SNP:PORTs?'1,2'''); 通过GPIB在我的PNA5230A中无法正常工作。 我总是得到“420-Query Unterminated”。 但是,较旧的指令可以正常工作并执行相同的操作:fprintf(instrObj,'CALC:DATA:SNP?2'); 使用* bhokkan *建议的示例,我可以在几秒钟内获得没有问题的数据。 但是,如果我增加扫描点的数量,我不得不增加GPIB的缓冲区大小,从PNA读取需要更长的时间。 (aprox.10s for 6401 points)我得到的格式是LogMag和Phase in degrees,任何人都可以帮我找到命令以获得Real / Im中的日期。 ? 以上来自于谷歌翻译 以下为原文 Hi, First of all many thanks for all your inputs. After a few days of testing, I can say the command : fprintf(instrObj, 'CALC:DATA:SNP:PORTs? '1,2'''); doesn't work properly in my PNA5230A through GPIB. I always get "420-Query Unterminated". However, the older instruction works ok and do the same: fprintf(instrObj, 'CALC:DATA:SNP? 2'); Using the example suggested by *bhokkan* I can get the Data with no problem in just a matter of seconds. However, If I increase the number of sweep points I am forced to increase the buffer size of the GPIB, and it will take a bit longer to read from PNA. (aprox. 10s for 6401 points) The format I am getting is LogMag and Phase in degrees, Can anyone help me to find the command to get the date in Real/Im. ? |
|
|
|
testd011 发表于 2018-10-24 21:29 您正在寻找的命令是MMEM:STOR:TRAC:FORM:SNP RI。 该命令的默认设置是AUTO,在这种情况下,数据的返回格式与Trace当前显示的格式相对应。注意:我刚刚引用的链接对应于PNAHelp的A.07.50.xx固件风格,因为 我注意到你提到你的PNA是N5230A。 以上来自于谷歌翻译 以下为原文 The command you're looking for is MMEM:STOR:TRAC:FORM:SNP RI. The default setting for that command is AUTO in which case the data gets returned in format corresponding to what format the Trace is currently displayed in. Note: the link I referenced just now corresponds to the A.07.50.xx firmware flavor of PNAHelp, since I note you mention your PNA is a N5230A. |
|
|
|
uwyywefwd 发表于 2018-10-24 21:38 再次感谢,现在就有一个问题。 我想阅读S21参数。 通过阅读s2p,我得到了所有的S参数值。 我对Magnitude和Phase感兴趣(无论格式如何)。 但是,我需要平滑我的S21幅度轨迹。 但是当我读到s2p时,我的S21相位也被平滑了! 这是不可取的。 如何获得,S21幅度平滑,但是没有平滑的S21相位? 有任何想法吗? 以上来自于谷歌翻译 以下为原文 Thanks again, Just have one issue now. I want to read the S21 parameters. Obvioully from reading the s2p I get all S parameters values. I am interested in Magnitude and Phase (no matter the format). However, I need to smooth my S21 Magnitude trace. But when I read s2p, my S21 phase is also smoothed! and this is not desirable. How can get, S21 Magnitude smoothed, but S21 Phase with no Smoothing applyied? Any ideas? |
|
|
|
您可以使用CALC:DATA直接读取跟踪数据吗? FDATA以当前格式读取当前数据。 所以设置平滑,设置格式为log mag,并读取数据; 然后关闭平滑,将格式设置为phase并再次读取数据。 或者,您可以设置2个轨迹,一个mag和平滑,一个具有相位和无平滑。 此外,只是评论:通常不适合在频率扫描上对幅度轨迹进行平滑,因为平滑从不同频率获取数据并将其平均在一起。 对于平滑处理提供时间平均的CW扫描来说很好。因此,如果您的DUT确实具有频率快速变化的响应(例如共振),那么它将被平滑掉并且不会告诉您真实值。 平滑通常用于消除由不良校准引起的波纹,但在这种情况下,最好只是弄清楚如何进行良好的校准。 平滑主要用于延迟测量以设置群延迟,但在较新的固件(可能3年)上,存在明确的群延迟峰值设置,其提供延迟所需的平滑功能。 以上来自于谷歌翻译 以下为原文 you can read the trace data directly, using the CALC:DATA? FDATA To read the currently data in it's current format. So set the smoothing on, set the format to log mag, and read the data; then turn the smoothing off, set the format to phase and read the data again. Or, you can setup 2 traces one mag and smoothing and one with phase and no smoothing. Also, just a comment: normally it is not appropriate to use smoothing on magnitude traces over frequency sweeps as smoothing takes data from different frequencies and averages it together. It's fine for CW sweeps where smoothing is providing a time average Thus if you DUT does have a response that changes quickly in frequency (such as a resonance) then it will be smoothed away and not tell you the true value. Smoothing is often used to remove ripples caused by bad calibrations, but in such a case it is better to just figure out how to do a good calibration. Smoothing is mostly used for delay measurements to set the group delay apeture, but on newer firmware (for maybe 3 years), there has been an explicit group delay apeture setting that provides the smoothing function needed for delay. |
|
|
|
谢谢,Dr_joel的意见。 我阅读了更多关于平滑的内容,我绝对不会使用它。 我将使用Average并降低IF带宽以减少噪声。 我现在设法读取S2P文件并通过GPIB完成所有PNA配置。 只是几个简单的问题,我注意到,如果我使用,'SENS:SWE:MODE HOLD''* WAI'%%读取s2p,其中'SENS:SWE:MODE CONT''* WAI'有时候PNA完全不让我 比例值(假设100中的1个错误)。 这将导致我的幅度测量中出现“尖峰”。 如果我没有跟踪,并且直接获得S2P,我的数据是正常的,没有尖峰。 任何想法 ?? 我不应该使用Hold并直接获得S2P吗? %-----------现在,一旦我通过GPIB成功读取S2P数据,我想只读取1个跟踪,以了解PNA的所有数据读取类型。 我正在做,'形式:BORD SWAP''形式真实,32''CALC:数据? FDATA'data = binblockread(vi,'float32'); 我可以读取没有问题的任何迹线,因为我使用REAL 32格式的任何数量的扫描点但是,如果我更改为,REAL 64,'FORM:BORD SWAP''FORM REAL,64''CALC:DATA? FDATA'data = binblockread(vi,'double'); 我无法读取痕迹。 我只能获得一半扫描点的准确值。 假设我配置为1601个扫描点,我只得到801个正确点。 其他人几乎为零。 有任何想法吗 ? 编辑:joaoreis于2015年2月5日上午6:45编辑:joaoreis于2015年2月5日上午6:46 以上来自于谷歌翻译 以下为原文 Thanks, Dr_joel for your input. I read more about smoothing and I will definitely not use it. I will use Average and decrease the IF bandwidth to reduce the noise instead. I have now managed to read S2P files and do all PNA configs via GPIB. Just a few more quick questions, I noticed that if I use, 'SENS:SWE:MODE HOLD' '*WAI' %% read s2p where 'SENS:SWE:MODE CONT' '*WAI' Sometimes PNA give me completely out of scale values (let's say 1reading wrong in 100). This will result in "spikes" in my magnitude measurements. If I don't hold the trace, and get the S2P directely, my data is ok and with no spikes. Any idea ?? Should I not use Hold and get S2P directly? % ----------- Now, once I have reading succefully S2P data through GPIB, I want to read only 1 trace, to be aware of all data reading types of PNA. I am doing, 'FORM:BORD SWAP' 'FORM REAL,32' 'CALC:DATA? FDATA' data = binblockread(vi, 'float32'); I can read any trace with no problem, for whatever number of sweep points I use with REAL 32 Format However, If I change to, REAL 64, 'FORM:BORD SWAP' 'FORM REAL,64' 'CALC:DATA? FDATA' data = binblockread(vi, 'double'); I am not able to read the trace. I only get accurate values for half of my sweep points. Let's say if I configure to have 1601 sweep points, I only get 801 correct points. The others are near zero. Any ideas ? Edited by: joaoreis on Feb 5, 2015 6:45 AM Edited by: joaoreis on Feb 5, 2015 6:46 AM |
|
|
|
只有小组成员才能发言,加入小组>>
1230 浏览 0 评论
2351 浏览 1 评论
2160 浏览 1 评论
2026 浏览 5 评论
2908 浏览 3 评论
974浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
707浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
808浏览 0评论
1230浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 10:59 , Processed in 1.583862 second(s), Total 59, Slave 52 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号