完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我有一个33522A波形发生器。
我正在尝试使用matlab创建一个特定的波形,并在USB上保存为CSV或ASCII格式,以便与波形发生器一起使用。 我已经阅读了手册,但我不知道该怎么做,但似乎有可能。 我的问题是如何做到这一点以及CSV或ASCII文件需要采用何种形式,因为是一个列时间值而另一个是电压值? 任何帮助,将不胜感激。 谢谢 以上来自于谷歌翻译 以下为原文 Hi, I have a 33522A waveform generator. I am trying to create an specific waveform using MATLAB and save in either an CSV or ASCII format on an USB to be used with the waveform generator. I have read the manual but am not sure how to do this but it seems like it would be possible. My question is how would one do this and in what form do the CSV or ASCII file need to be in, as in is one column time values while another is voltage values? Any help would be appreciated. Thanks |
|
相关推荐
1个回答
|
|
感谢lhornburg的回复。
我编写了一个MATLAB函数,它接收波形(或两个波形)并将其转换为.arb格式。 我通过查看波形发生器软件包的输出来做到这一点。 现在我正在尝试将其写入.barb(二进制)文件。 有没有人这样做或知道二进制文件中写出来的格式以下是我目前的功能:功能[waveform_ch1_arb waveform_ch2_arb] = write_waveform_2_ch(文件名,waveform_ch1,waveform_ch2,FS)%%计算低速& 高压值num_pts = length(waveform_ch1); voltage_high = max(max(waveform_ch1),max(waveform_ch2)); voltage_low = min(min(waveform_ch1),min(waveform_ch2)); %%从电压电平转换为16位数电压_to_bit = 2 ^ 15-1; max_abs = max(voltage_high,abs(voltage_low)); waveform_ch1_arb = round((waveform_ch1./ max_abs)。* voltage_to_bit); waveform_ch2_arb = round((waveform_ch2./ max_abs)。* voltage_to_bit); %%以ARB格式保存fid = fopen(filename,'w'); fprintf(fid,'%s n','频道数:2'); fprintf(fid,'%s','采样率:'); fprintf中(FID, '%I N',FS); fprintf(fid,'%s','High Level:'); fprintf中(FID, '%I N',voltage_high); fprintf(fid,'%s','低级:'); fprintf中(FID, '%I N',voltage_low); fprintf(fid,'%s','数据点:'); fprintf中(FID, '%I N',num_pts); fprintf中(FID, '%S n', '数据:'); 对于i = 1:长度(waveform_ch1); fprintf(fid,'%i t%i n',[waveform_ch1_arb(i)waveform_ch2_arb(i)]); 结束fclose(fid); 任何帮助将不胜感激。 谢谢 以上来自于谷歌翻译 以下为原文 Thanks for the reply lhornburg. I have written a MATLAB function that takes a waveform (or two waveforms) and converts it to .arb format. I did this by looking at an output of the waveform generator software package. Now I am trying to write it to .barb (binary) file. Has anyone done this or know the format that the binary file is written out in. The following is my current function: function [waveform_ch1_arb waveform_ch2_arb] = write_waveform_2_ch(filename,waveform_ch1,waveform_ch2,Fs) %% Calculate Low & High Voltage Values num_pts = length(waveform_ch1); voltage_high = max(max(waveform_ch1),max(waveform_ch2)); voltage_low = min(min(waveform_ch1),min(waveform_ch2)); %% Convert From Voltage Level To 16 Bit Number voltage_to_bit = 2^15-1; max_abs = max(voltage_high,abs(voltage_low)); waveform_ch1_arb = round((waveform_ch1./ max_abs).*voltage_to_bit); waveform_ch2_arb = round((waveform_ch2./ max_abs).*voltage_to_bit); %% Save In ARB Format fid = fopen(filename,'w'); fprintf(fid,'%sn','Channel Count:2'); fprintf(fid,'%s','Sample Rate:'); fprintf(fid,'%in',Fs); fprintf(fid,'%s','High Level:'); fprintf(fid,'%in',voltage_high); fprintf(fid,'%s','Low Level:'); fprintf(fid,'%in',voltage_low); fprintf(fid,'%s','Data Points:'); fprintf(fid,'%in',num_pts); fprintf(fid,'%sn','Data:'); for i = 1:length(waveform_ch1); fprintf(fid,'%it%in',[waveform_ch1_arb(i) waveform_ch2_arb(i)]); end fclose(fid); end Any help would be appreciated. Thanks |
|
|
|
只有小组成员才能发言,加入小组>>
1240 浏览 0 评论
2352 浏览 1 评论
2164 浏览 1 评论
2030 浏览 5 评论
2914 浏览 3 评论
983浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
713浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
813浏览 0评论
1240浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-30 09:03 , Processed in 1.585008 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号