⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rplotsig.m

📁 hspice toolbox with matlab.
💻 M
字号:
% Plot expressions invoking signal names from structure x.
% Usage: plotsig(x, exp) or plotsig(x, exp, plot_args)
%        where plot_args is 'logx', 'logy', or 'logxy'.
% In exp, commas delimit curves to be overlayed and semicolons delimit
% seperate subplots on the same figure.  E.g., plotsig(x,'v1,v2;v3')
% creates two subplots, with voltages v1 and v2 overlayed.  Also note
% that numeric node names should be prepended by '@' to distinguish
% them from constants.
%  written by Mike Perrott with modifications by Scott Willingham
%
% more mods by Russell Croman
% 

function [] = rplotsig(x,exp,plot_args)

clf;
delim_m = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789@+-/*^().:';

nsp = 1 + sum(exp == ';');	% number of subplots

r = exp;

%% separate curves by '?' to avoid confusion with function arg delimiters
net_paren = 0;
for i=1:length(r)
   if r(i) == '('
      net_paren = net_paren+1;
   elseif r(i) == ')'
      net_paren = net_paren-1;
   elseif r(i) == ','
      if net_paren == 0
        r(i) = '?';
      end
   end
end

for i = 1:nsp
    subplot(nsp,1,i);
    cplot = [];
    [t,r] = strtok(r,';');
    while length(t) > 0
	[s,t] = strtok(t,'?');
	if length(s) > 0
	    cplot = [cplot, cellstr(s)];
	end
	[s,t] = strtok(t,delim_m);
    end
    if nargin > 2
	rplotsig1(x,cplot,plot_args);
    else
	rplotsig1(x,cplot);
    end

    for j = 1:length(cplot)
      cplot(j) = strrep(cplot(j), '_', '.');
    end

    legend(cplot,0);
end

xlabel(x(1).name);

zoom on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -