2012年11月21日 星期三

[Hspice] Import Hspice simulation result into Matlab

In order to import thoseHspice simulation result into Matlab, HspiceToolbox can be used. details can be found from the links below:

http://www.edaboard.com/thread115394.html


n short, enter command "addpath ('C:\Users\Davison Mui\Documents\MATLAB\HspiceToolbox')" to include the Toolbox.

Second, enter command " x = loadsig('C:\Hspice\Circuit\Study\Charge pump\Simple Charge pump\simple charge pump.tr0')" to import the data.

That's all~~

Sample Matlab Code:

clear all
close all
clc;

addpath ('C:\Users\Davison Mui\Documents\MATLAB\HspiceToolbox')
x = loadsig('C:\Hspice\Circuit\Study\Charge pump\Simple Charge pump\simple charge pump.tr0')
% plot(x(10,1).data,'DisplayName','x(10,1).data','YDataSource','x(10,1).data');figure(gcf)
lssig(x)
figure;
plotsig(x, 'i_mp4');
hold on;

% % combin the value to a sum of vector
% http://www.mathworks.com/help/matlab/ref/timeseries.resample.html
i_mp4 = timeseries(evalsig(x, 'i_mp4'),evalsig(x, 'TIME'),'Name','sec');
i_mp4.time
i_mp4.data
i_mp4.getinterpmethod

% res_mp4=resample(i_mp4,[1:1e-6:max(evalsig(x, 'TIME'))]);
res_mp4=resample(i_mp4,[0:1e-9:max(evalsig(x, 'TIME'))]);
% figure;
plot(res_mp4, 'green');

沒有留言:

張貼留言