wildgoat的个人空间 https://blog.eetop.cn/wildgoat [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

[ZZ]Export Cadence plot data into MATLAB manually

热度 1已有 2294 次阅读| 2011-11-8 17:32 |个人分类:Cadence

This will describe how to do a Parametric Analysis in Cadence, as well as how to export the data from that analysis into MATLAB for further processing.

The goal of this simulation is to measure the drain current of an NMOS as a function of Vgs for different values of Vds. We will use the circuit shown below. Make sure to enter "Vds" as the value of the DC voltage field for the drain's voltage source.

SchematicForMATLAB.png

Next, click "Launch → ADE L" to launch the simulator. In the simulator, select a DC analysis, sweeping Vgs from 0 to 3V. Add the drain current as the output. Next, click on "Variables → Edit" to bring up the variable editor. Enter Vds as the name and click add. Don't worry about the Value, this will be set when the parametric sweep is initialized. It should look like this:

VariableEditorWindow.png

Say OK to close the editor window. Now, click "Tools → Parametric Analysis" to bring up the parametric analysis setup. In the variable name, put Vds. In the range, put From 1 to 3. As the Step Control, select Linear Steps and put a Step Size of 1. The window should look like this:

ParametricAnalysisSetup.png

Now, click "Analysis → Start", and this will begin the simulation. Parametric analysis runs the DC simulation for changing Vgs from 0 to 3, but it runs it one time each for Vds = 1, 2, and 3V. The output from Cadence will look like this:

ParametricAnalysisOutput.png

To export the data into MATLAB, click on "Trace → Select All". This will select all of the waveforms. Next, click "Trace → Save". This will bring up a file dialog. Select your location, select the file type to be "Comma Separated Value (.csv)", and give it a name of filename.csv (Make sure to put the .csv as part of the filename.

WaveformDialog.png

This creates a plaintext version of all the X,Y pairs from the Cadence plot. If there are multiple waveforms, the first column is the X value of the first waveform, the second column is the Y value of the first waveform, the third column is the X value of the second waveform, the fourth column is the Y value of the second waveform, and so on.

Next, run MATLAB. The first command to type is

>> plotData = importdata('parametricOut.csv');

This will import all the plot data from your csv file into a MATLAB struct. It contains both the text that is at the top of the columns and the data. The text for column one, for example, can be accessed by typing

>> plotData.colheaders(1)

ans =

 'N0:d (Vds=1.00e+00) X'

To access the data, you could type

>> plotData.data(1)

which would show all of the X values from your Cadence plot. Now, to recreate our plot, the following code is run:

>>figure(1)

>>clf

>>hold on

>>grid on

>>plot(plotData.data(:,1),plotData.data(:,2),'r','LineWidth',2)

>>plot(plotData.data(:,3),plotData.data(:,4),'g','LineWidth',2)

>>plot(plotData.data(:,5),plotData.data(:,6),'b','LineWidth',2)

The output should look like this:

MatlabFigureOutput.png

which is exactly the same graph as above from Cadence. Now that you know how to move data from Cadence to MATLAB, you can do all sorts of things, like max and min, diff, linear fit, etc. It may be a little bit more work to export rather than using the built in Cadence calculator, but for more advanced calculations and scripting, it works quite well.

1

点赞

刚表态过的朋友 (1 人)

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 121

    粉丝
  • 41

    好友
  • 269

    获赞
  • 117

    评论
  • 22096

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-3-29 18:26 , Processed in 0.042569 second(s), 14 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部