以上來自于谷歌翻譯
以下為原文
Interesting...
- You cross-posted to two forums. I have deleted the other post.
- You don't indicate what scope you are using or what you have tried.
Most Keysight (and Agilent) scopes have an FFT or Spectrum function available. Have you looked at those?
Is this for a school project?
Al
2018-10-12 17:40:55
評論
提交評論
是的,這是一個有點學校的項目,我正在嘗試為我們的電子實驗室開發一個程序,以節省在電路上重復測量的時間。
我正在使用33522B波形發生器,它正在發送正弦波,其值由用戶決定電路。
這是代碼。
+ function userTest(start,stop,amp)+ + fgen = visa('AGILENT','GPIB0 :: 10 :: INSTR'); + + set(fgen,'OutputBufferSize',100000); + + fopen(fgen)
; + + fprintf(fgen,'* IDN?'); + + idn = fscanf(fgen); + + fprintf(idn)+ + fprintf('\ n \ n')+ + fprintf(fgen,'* RST'
); + + fprintf(fgen,'* CLS'); + + fprintf(fgen,'SOURCE1:FUNCTION SIN'); + + fprintf(fgen,'SOURCE1:VOLT:UNIT VPP'); + + fprintf(fgen,
convertStrAmp(amp)'); + + fprintf(fgen,convertStartFrq(start)); + + fprintf(fgen,convertStopFrq(stop)); + + fprintf(fgen,'SOURCE1:SWEEP:SPACING LINEAR'); + + fprintf
(fgen,'SOURCE1:SWEEP:TIME 20'); + + fprintf(fgen,'TRIGGER1:SOURCE IMM'); + + fprintf(fgen,'SOURCE1:SWEEP:STATE ON'); + + fprintf(fgen,'
OUTPUT1 ON'); + + fprintf(fgen,'SYST:ERR?'); + + errorstr = fscanf(fgen); + +%錯誤檢查+ +如果strncmp(errorstr,'+ 0,“沒有錯誤”',13
)+ + errorcheck ='沒有任何錯誤生成的波形\ n'; + + fprintf(錯誤檢查)+ + else + + errorcheck ='有錯誤\ n'; + + fprintf(錯誤檢查)+ +結束+ + fclose(fgen)
; + +刪除(fgen); + +結束+現在我想要mea
確定電路中元件的相位和幅度(R,L,C等)。
順便說一下儀器是MSO-X 2014A。
實際上,我認為我可以使用MEASure:FREQUENCY和MEASure:PHASE命令。
問題我無法在matlab上保留值并繪制它。
不幸的是,我找不到4000系列程序員指南中的頻譜命令。
另外,抱歉重復發帖。
我已經意識到我的第一篇文章的錯誤,我無法刪除它。
以上來自于谷歌翻譯
以下為原文
Yeah, it's kinda school project, I'm trying to develop a program for our electronic lab to save time for repeating measurement at circuits.
I'm using 33522B Waveform generator which on I'm sending sine wave whose values decided by user to circuits. Here's the code.
+function userTest(start,stop,amp)+
+fgen = visa('AGILENT','GPIB0::10::INSTR');+
+set (fgen,'OutputBufferSize',100000);+
+fopen(fgen);+
+fprintf (fgen, '*IDN?');+
+idn = fscanf (fgen);+
+fprintf (idn)+
+fprintf ('\n\n')+
+fprintf (fgen, '*RST');+
+fprintf (fgen, '*CLS');+
+fprintf(fgen,'SOURCE1:FUNCTION SIN');+
+fprintf(fgen,'SOURCE1:VOLT:UNIT VPP');+
+fprintf(fgen,convertStrAmp(amp)');+
+fprintf(fgen,convertStartFrq(start));+
+fprintf(fgen,convertStopFrq(stop));+
+fprintf(fgen,'SOURCE1:SWEEP:SPACING LINEAR');+
+fprintf(fgen,'SOURCE1:SWEEP:TIME 20');+
+fprintf(fgen,'TRIGGER1:SOURCE IMM');+
+fprintf(fgen,'SOURCE1:SWEEP:STATE ON');+
+fprintf(fgen,'OUTPUT1 ON');+
+fprintf(fgen, 'SYST:ERR?');+
+errorstr = fscanf (fgen);+
+% error checking+
+if strncmp (errorstr, '+0,"No error"',13)+
+errorcheck = 'Waveform generated without any error \n';+
+fprintf (errorcheck)+
+else+
+errorcheck = 'There is a error \n';+
+fprintf (errorcheck)+
+end+
+fclose(fgen);+
+delete(fgen);+
+end+
Now I want to measure phase and amplitude of an element in a circuit? (R,L,C etc.). By the way the instrument is MSO-X 2014A.? Actually, I thought that I can use
MEASure: FREQUENCY and MEASure: PHASE command. The problem I can't hold the value on the matlab and plot it.
Unfortunatley, I couldn't find a command for spectrum in 4000's series programmer guide.
Also, sorry for repeating posts. I've realized my mistake for first post and I couldn't delete it.
2018-10-12 17:49:27
評論
提交評論
也許你輸錯了,但是當你有2000系列示波器時,我不明白為什么你看了4000系列編程指南。
在任何情況下,2000和4000系列示波器都具有FFT功能。
如果要使用它,則必須打開它并從中卸載數據。
*盡管*,這可能不是進行此測量的正確方法。
您可能想要做的是將源設置為給定頻率(此時您正在掃描它)和幅度,然后讀取輸入和輸出的當前幅度,以及兩個信號之間的相位。
這兩種測量都會產生噪音,因此您可能需要多次進行所有測量并對結果取平均值。
然后,您需要將信號源設置為新的頻率和幅度,然后進行另一組測量。
您不能只掃描并進行一次測量。
您必須同步源和范圍。
人
以上來自于谷歌翻譯
以下為原文
Maybe you mistyped, but I don't understand why you looked in the 4000 series programming guide, when you have a 2000 series scope.
In any case, both the 2000 and the 4000 series scopes have an FFT function. If you want to use it, you will have to turn it on and unload the data from it.
*That's probably not the correct way to do this measurement, though*. What you probably want to do is set the source to a given frequency (right now you are sweeping it) and amplitude, then read the current magnitude of the input and output, along with the phase between the two signals. Both of these measurements will be noisy, so you will probably want to make all measurements multiple times and average the results. Then you'll want to set the source to a new frequency and amplitude and make another set of measurements. You can't just sweep and make one measurement. You have to synchronize the source and the scope.
Al
2018-10-12 17:57:06
評論
提交評論
好的,現在遇到了問題。
非常感謝 !
順便說一句,我找不到2k-X系列指南。
以上來自于谷歌翻譯
以下為原文
Ok, got what the problem is now. Thanks a lot !
I couldn't find the 2k-X series guide by the way.
2018-10-12 18:14:17
評論
提交評論
“順便說一下,我找不到2k-X系列指南。”
嗯......我們試著讓這很容易。
我搜索了“MSOX2014”并進入了產品頁面。
我選擇了“文檔”選項卡,然后單擊“手冊”對列表進行了細化。
列表中有6個,包括pdf和chm格式的編程指南。
祝你的申請好運...... Al
以上來自于谷歌翻譯
以下為原文
"I couldn't find the 2k-X series guide by the way."
Hmmm... We try to make that pretty easy.
I searched on "MSOX2014" and got to the Product page. I selected the 'Documents' tab, then refined the list by clicking on 'Manuals'. There were 6 in the list, including the Programming Guide in pdf and chm formats.
Good luck with your application...
Al
2018-10-12 18:23:38
評論
提交評論
好吧,我帶來了一個解決方案。
這是交易。
但它給出了超時錯誤。
+ function userTest(start,stop,amp,data_points)+ + fgen = visa('AGILENT','GPIB0 :: 10 :: INSTR'); + + set(fgen,'OutputBufferSize',100000); + + fgen。
超時= 10; + + fopen(fgen); + +%MSO-2014A + + mso =簽證('AGILENT','GPIB0 :: 7 :: INSTR'); + + set(mso,'OutputBufferSize',100000);
+ + mso.Timeout = 10; + + fopen(mso); + +%查詢Idendity字符串和報告+ + fprintf(fgen,'* IDN?'); + + idn = fscanf(fgen); + + fprintf(idn)
+ + fprintf('\ n \ n')+ +%查詢Idendity字符串和報告+ + fprintf(mso,'* IDN?'); + + idn = fscanf(mso); + + fprintf(idn)+ + fprintf(
'\ n \ n')+ +%清除并重置樂器+ + fprintf(fgen,'* RST'); + + fprintf(fgen,'* CLS'); + +%清除并重置樂器+ + fprintf(mso,'
* RST'); + + fprintf(mso,'* CLS'); + + fprintf(mso,':ACQuire:TYPE NORMal'); + +%選擇波形形狀,幅度和偏移+ + fprintf(fgen,'SOURCE1
:FUNCTION SIN'); + + fprintf(fgen,'SOURCE1:VOLT:UNIT VPP'); + + fprintf(fgen,convertStrAmp(amp)'); + +%選擇掃描的頻率邊界+ + fprintf(fgen,
convertStartFrq(start)); + + fprintf(f
gen,convertStopFrq(stop)); + +%選擇掃描模式+ + fprintf(fgen,'SOURCE1:SWEEP:SPACING LINEAR'); + +%設置掃描時間(秒)。+ + fprintf(fgen,'SOURCE1:SWEEP
:TIME 5'); + +%選擇掃描觸發源+ + fprintf(fgen,'TRIGGER1:SOURCE IMM'); + +%啟用掃描狀態。+ + fprintf(fgen,'SOURCE1:SWEEP:STATE ON');
+ +%啟用輸出。+ + fprintf(fgen,'OUTPUT1 ON'); + + a =開始:(停止 - 開始)/ data_points:停止-1; + + b = 1:1:data_points; + + c =
1:1:data_points; + +表示j = 1:1:data_points + fprintf(mso,'MEASure:VAMPlitude CHAN2');
b(j)= str2double(查詢(mso,'MEASure:VAMPlitude?'));
fprintf(mso,'MEASure:PHASe CHAN1,CHAN2');
c(j)= str2double(查詢(mso,'MEASure:PHASe?CHAN1,CHAN2'));
暫停(5 / data_points)+結束+ +%啟用輸出+ +%fprintf(fgen,'OUTPUT ON');
%打開通道1輸出+%讀取錯誤+ + fprintf(fgen,'SYST:ERR?'); + + errorstr = fscanf(fgen); + +%錯誤檢查+ +如果strncmp(errorstr,'+ 0,“沒有錯誤
“',13)+ + errorcheck ='波形生成沒有任何錯誤\ n'; + + fprintf(錯誤檢查)+ + else + + errorcheck ='有錯誤\ n'; + + fprintf(錯誤檢查)+ +結束+ +
%使用函數生成器關閉簽證會話+ + fclose(fgen); + +刪除(fgen); + + fclose(mso); + +刪除(mso); + +%disp(size(a)); + +%
disp(size(b)); + + subplot(1,2,1); + + stem(a,b); + + xlabel('frequency [hz]'); + + ylabel('magnitude [v_ {pp
}]'); + + subplot(1,2,2); + + stem(a,c); + + xlabel('frequency [hz]'); + + ylabel('phase [pi]'); +
+ end +編輯:mduden于2016年1月6日上午11:16
以上來自于谷歌翻譯
以下為原文
Well, I came with a solution. Here's the deal. But it gives a timeout error.
+function userTest(start,stop,amp,data_points)+
+fgen = visa('AGILENT','GPIB0::10::INSTR');+
+set (fgen,'OutputBufferSize',100000);+
+fgen.Timeout=10;+
+fopen(fgen);+
+%MSO-2014A+
+mso = visa('AGILENT','GPIB0::7::INSTR');+
+set (mso,'OutputBufferSize',100000);+
+mso.Timeout=10;+
+fopen(mso);+
+%Query Idendity string and report+
+fprintf (fgen, '*IDN?');+
+idn = fscanf (fgen);+
+fprintf (idn)+
+fprintf ('\n\n')+
+%Query Idendity string and report+
+fprintf (mso, '*IDN?');+
+idn = fscanf (mso);+
+fprintf (idn)+
+fprintf ('\n\n')+
+%Clear and reset instrument+
+fprintf (fgen, '*RST');+
+fprintf (fgen, '*CLS');+
+%Clear and reset instrument+
+fprintf (mso,'*RST');+
+fprintf (mso,'*CLS');+
+fprintf(mso,':ACQuire:TYPE NORMal');+
+%Select the waveform shape, amplitude and offset+
+fprintf(fgen,'SOURCE1:FUNCTION SIN');+
+fprintf(fgen,'SOURCE1:VOLT:UNIT VPP');+
+fprintf(fgen,convertStrAmp(amp)');+
+%Select the frequency boundaries of the sweep+
+fprintf(fgen,convertStartFrq(start));+
+fprintf(fgen,convertStopFrq(stop));+
+%Select the sweep mode+
+fprintf(fgen,'SOURCE1:SWEEP:SPACING LINEAR');+
+%Set the sweep time in seconds.+
+fprintf(fgen,'SOURCE1:SWEEP:TIME 5');+
+%Select the sweep trigger source+
+fprintf(fgen,'TRIGGER1:SOURCE IMM');+
+%Enable Sweep State.+
+fprintf(fgen,'SOURCE1:SWEEP:STATE ON');+
+%Enable output.+
+fprintf(fgen,'OUTPUT1 ON');+
+a = start:(stop-start)/data_points:stop-1;+
+b = 1:1:data_points;+
+c = 1:1:data_points;+
+for j=1:1:data_points+
fprintf(mso,'MEASure:VAMPlitude CHAN2');
b(j) = str2double(query(mso,'MEASure:VAMPlitude?'));
fprintf(mso,'MEASure:PHASe CHAN1,CHAN2');
c(j) = str2double(query(mso,'MEASure:PHASe? CHAN1, CHAN2'));
pause(5/data_points)
+end+
+%Enable Output+
+% fprintf(fgen,'OUTPUT ON'); % turn on channel 1 output+
+% Read Error+
+fprintf(fgen, 'SYST:ERR?');+
+errorstr = fscanf (fgen);+
+% error checking+
+if strncmp (errorstr, '+0,"No error"',13)+
+errorcheck = 'Waveform generated without any error \n';+
+fprintf (errorcheck)+
+else+
+errorcheck = 'There is a error \n';+
+fprintf (errorcheck)+
+end+
+%closes the visa session with the function generator+
+fclose(fgen);+
+delete(fgen);+
+fclose(mso);+
+delete(mso);+
+% disp(size(a));+
+% disp(size(b));+
+subplot(1,2,1);+
+stem(a,b);+
+xlabel('frequency [hz]');+
+ylabel('magnitude [v_{pp}]');+
+subplot(1,2,2);+
+stem(a,c);+
+xlabel('frequency [hz]');+
+ylabel('phase [pi]');+
+end+
Edited by: mduden on Jan 6, 2016 11:16 AM
2018-10-12 18:40:46
評論
提交評論
如果您收到超時錯誤,那么是時候進行一些調試以確定哪個命令不起作用。
在你這樣做之前,你需要回到基礎并停止SWEEPING!
- 您可能會使用此代碼獲得某種曲線,但不會根據頻率進行校準。
您將在“隨機”時間獲得結果,但您不會知道每次測量的捕獲頻率。
你需要知道這一點。
- 因為你的頻率會不斷變化,一個接一個地測量幅度和相位,然后平均會給你帶來奇怪的,不好的結果。
每次測量都將以不同的頻率進行,如上所述,您將不知道這些頻率是什么,或者它們改變了多少。
- 知道輸出幅度很大,但您也需要知道輸入幅度。
您的電路可能具有不同的輸入阻抗,這也會導致幅度發生變化。
- 我很確定您正在使用MEASURE命令和查詢錯誤,但我沒有2000系列范圍來測試。
我的所有編程都是使用Infiniium示波器完成的。
您應該花一些時間使用Keysight I / O Libraries Suite的交互式I / O功能。
它允許您微調命令。
下載免費的Command Expert SW也可能很有用。
它還可以幫助您正確地獲取代碼,創建可以交互式測試的序列,然后直接導出到MATLAB腳本。
您正在嘗試模擬VNA,為此,您需要了解VNA的工作原理。
這里有一些基本信息:http://www.keysight.com/main/redirector.jspx?action = ref& cname = EDITORIAL& ckey = 1000001258-1%3Aepsg%3Atcn& pl = eng& amp; cc = US& nfr =
-11143.0.00這比你需要的多,但他們談論的是放大器和濾波器的測試。
人
以上來自于谷歌翻譯
以下為原文
If you're getting a timeout error, then it's time to do some debugging to figure out which command isn't working.
Before you do that, you need to go back to basics and STOP SWEEPING!
- You might get some sort of a curve with this code, but it won't be calibrated to frequency. You will get results at "random" times, but you won't know what frequency each measurement is captured at. You need to know that.
- Because your frequency will be changing constantly, measuring amplitude and phase one after the other, and then averaging will give you strange, and bad results. Each measurement will be made at a different frequency, and, as I said above, you won't know what those frequencies are, or how much they change.
- Knowing the output amplitude is great, but you need to know the input amplitude as well. Your circuit may have varying input impedance which will cause that amplitude to change as well.
- I'm pretty sure that you are using the MEASURE commands and queries incorrectly, but I don't have a 2000 series scope to test with. All of my programming is done with Infiniium scopes. You should spend some time with the Interactive I/O feature of the Keysight I/O Libraries Suite. It allows you to fine-tune your commands. It might also be useful to download the free Command Expert SW. It will also help you get the code right, creating sequences that you can test interactively, then export directly to MATLAB scripts.
You are trying to emulate a VNA, and to do that you need to learn how a VNA works. There's some basic information here: http://www.keysight.com/main/redirector.jspx?action=ref&cname=EDITORIAL&ckey=1000001258-1%3Aepsg%3Atcn&lc=eng&cc=US&nfr=-11143.0.00 It's more than you need, but they talk about testing amplifiers and filters.
Al
2018-10-12 18:54:01
評論
提交評論
以上來自于谷歌翻譯
以下為原文
Your data looks wrong to me.
- You don't say if the 22uF cap is in series or in parallel. In either case both graphs look wrong.
- It's unclear if there is any termination on the output, or if it's just probed.
- You need to convert your phase display to unwrapped phase
- Just putting a delay in your code doesn't guarantee that the scope will make the measurements at exact intervals. It takes time for the scope to get the command, parse it, and get the data back. There are varying delays in this process.
Your code should be as follows:
- set a frequency and amplitude
- run the scope in single mode some number of times and measure the input and output amplitudes, along with the phase each time
- do it again
You should also run a simulation to see what your results should look like.
Al
2018-10-12 19:07:37
評論
提交評論
好的,非常感謝。
特別感謝您的耐心等待。
我還有一個問題:)考慮到您的步長和150歐姆電阻和22uF電容串聯,是否可以為for循環中的電容創建復數陣列(阻抗)Z = R + jX?
For loop將測量您提到的每個頻率的電壓,而不是掃描。
R =電阻值(DC),V(c)/ I,I可以測量環路中每次測量時的電流值,來自另一個電阻器100歐姆。
X =電抗= 1 /(2 * pi * f * c),將在每個頻率測量。
在循環結束時,它將創建Z陣列,我想我可以繪制阻抗的幅度和相位的展開(角度(Z))和abs(Z)。
以上來自于谷歌翻譯
以下為原文
Ok, thank you very much. Especially thank you for your patience. I have one more question :)
Considering your step and 150 ohm resistor and 22uF capacitance in series, is it possible to create complex number array (impedance) Z = R + jX for capacitance in a for loop ? For loop will measure voltages at every frequency as you mentioned, not sweeped.
R = resistor value (DC), V(c) / I, I can measure current value at every measurement in the loop from the other resistor 100 ohm.
X = reactance = 1/(2*pi*f*c), will measure at every frequency.
at the end of the loop, it will create Z array and I think I can plot unwrap(angle(Z)) and abs(Z) for magnitude and phase of impedance.
2018-10-12 19:17:52
評論
提交評論
從理論上講,可以做你想做的事。
在實踐中,這很難。
每個器件,無論是電阻器,電容器還是電感器,都具有串聯和并聯的電阻,電容和電感。
即使是用于進行測量的電線和適配器也是如此。
您必須考慮用于進行測量的信號源和探頭的復阻抗。
有很聰明的人非常努力地編寫SW來進行這些計算。
有商業軟件包,一些非常昂貴,將取得你的結果,并將它們變成最合適的模型。
請查看此范圍探針手冊,尤其是Performance Plots和Spice Models。
http://www.keysight.com/main/redirector.jspx?action=ref&cname=EDITORIAL&ckey=890537&lc=eng&cc=US&nfr=-34023.536894991.00我知道創建此數據的人
。
我知道如何解釋他們創建的數據,但我無法創建這些圖形和模型。
他們多年來一直這樣做,并且仍然承認他們不知道他們應該知道多少。
人
以上來自于谷歌翻譯
以下為原文
In theory, it is possible to do what you want. In practice, it's very hard.
Every device, whether it's a resistor, capacitor or inductor, has resistance, capacitance, and inductance, both in series and in parallel. The same thing applies to even the wires and adapters that you use to make the measurement. You have to take into account the complex impedance of the signal source, and the probe, that you are using to make the measurement.
There are very smart people who work very hard to write SW to make these calculations. There are commercial SW packages, some very expensive, that will take your results and turn them into a best fit model.
Take a look at this scope probe manual, especially the Performance Plots and Spice Models.
http://www.keysight.com/main/redirector.jspx?action=ref&cname=EDITORIAL&ckey=890537&lc=eng&cc=US&nfr=-34023.536894991.00
I know the guys who created this data. I know how to interpret the data they create, but there's no way I could create these graphs and models. They have been doing this for years, and still admit that they don't know as much as they should.
Al
2018-10-12 19:30:18
評論
提交評論
好的,我明白了,感謝您的留言和幫助。
我會考慮這個。
以上來自于谷歌翻譯
以下為原文
Ok, I got it, thanks for your messages and help. I'll consider this.
2018-10-12 19:45:45
評論
提交評論
只有小組成員才能發言,加入小組>>