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

📄 fm_plot.m

📁 用于电力系统的一个很好的分析软件
💻 M
📖 第 1 页 / 共 2 页
字号:
  warning off  lastwarn('')  switch tag   case 'PushEPS'    nomefile = fm_filenum('eps');    print(Fig.plot,'-depsc',[Path.data,nomefile])    set(hdlfig,'Position',axs_pos);    set(hdlfig2,'Position',ax2_pos);    set(Fig.plot,'Position',fig_pos)    set(Fig.plot,'PaperPosition',pap_pos)    if Settings.hostver > 5.3,      set(Fig.plot,'PaperSize',pap_siz)    end    set(Hdl_all,'Visible','on');    if leg_value      set(Hdl.legend,'Position',pos_leg);    end   case 'PushMeta'    print(Fig.plot,'-dmeta')    set(hdlfig,'Position',axs_pos);    set(hdlfig2,'Position',ax2_pos);    set(Fig.plot,'Position',fig_pos)    set(Fig.plot,'PaperPosition',pap_pos)    if Settings.hostver > 5.3,      set(Fig.plot,'PaperSize',pap_siz)    end    set(Hdl_all,'Visible','on');    if leg_value      set(Hdl.legend,'Position',pos_leg);    end   case 'PushFig'    figplot = Fig.plot;    Fig.plot = 0;    try      figpos = get(0,'factoryFigurePosition');      axspos = get(0,'factoryAxesPosition');      figunit = get(0,'factoryFigureUnits');      axsunit = get(0,'factoryAxesUnits');    catch      figpos = [100 100 660 520];      axspos = [0.1300 0.1100 0.7750 0.8150];      figunit = 'pixels';      axsunit = 'normalized';    end    set(figplot, ...        'Units',figunit, ...        'Position',figpos, ...        'Menubar','figure', ...        'Name','', ...        'NumberTitle','on', ...        'CreateFcn','', ...        'DeleteFcn','', ...        'UserData',[], ...        'FileName','')    set(Hdl.axesplot,'Color',[1 1 1],'Units',axsunit,'Position',axspos)    if leg_value      set(Hdl.legend,'Color',[1 1 1])    end    delete(Hdl_all)    delete(hdlfig2)    fm_plotfig    figure(figplot)  end  if ~isempty(lastwarn) & ~strcmp(lastwarn,'File not found or permission denied')    fm_disp(lastwarn,2),  end  warning on case 'plottypes'  tipoplot = get(Hdl_tipoplot,'Value');  switch tipoplot   case 1,    set(Fig.plot, ...        'DefaultAxesColorOrder',Settings.color, ...        'DefaultAxesLineStyle','-');   case 2,    set(Fig.plot, ...        'DefaultAxesColorOrder',[ 0 0 0 ], ...        'DefaultAxesLineStyleOrder','-|-.|--|:');   case 3,    set(Fig.plot, ...        'DefaultAxesColorOrder',[ 0 0 0 ], ...        'DefaultAxesLineStyle','-');   case 4,    set(Fig.plot, ...        'DefaultAxesColorOrder',[ 0 0 0 ], ...        'DefaultAxesLineStyle','-');   otherwise,    set(Fig.plot, ...        'DefaultAxesColorOrder',Settings.color, ...        'DefaultAxesLineStyle','-');  end  fm_plot('plotvars') case 'editvarname'  value =  get(Hdl_listplot,'Value');  if ~isempty(get(Hdl_listplot,'String'))    valori = get(Hdl_listvar,'Value');    val = valori(Varname.pos(value));    stringa = Varname.fvars(Varname.idx);    nomeattuale = popupstr(Hdl_listplot);    idx = findstr(nomeattuale,']');    nomeattuale = nomeattuale(idx+2:end);    nomenuovo = fm_input('Input Formatted Text:', ...                         'Legend Name',1,{stringa{val}});    if isempty(nomenuovo),      return,    end    Varname.fvars{Varname.idx(val)} = nomenuovo{1};    set(Fig.plot,'UserData',stringa);    fm_disp(['Formatted text of variable "', ...             nomeattuale,'" has been changed in "', ...             nomenuovo{1},'"'])  else    fm_disp('No variable selected')  end case 'zoomy'  zoom yon  set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion');  set(hdl_zoom1,'Value',0);  set(hdl_zoom2,'Value',0);  if get(hdl_zoom3,'Value')    Settings.zoom = 'zoom yon';  else    Settings.zoom = '';    zoom off  end case 'axesy'  if get(hdl_x,'Value')    set(hdl_x,'Value',0)    delete(findobj(allchild(hdlfig),'UserData','x axis'))  end  if get(hdl_xy,'Value')    set(hdl_xy,'Value',0)    delete(findobj(allchild(hdlfig),'UserData','x axis'))    delete(findobj(allchild(hdlfig),'UserData','y axis'))  end  value = get(gcbo,'Value');  if value    ylim = get(hdlfig,'YLim');    hold on    h = plot([0 0],[ylim(1), ylim(2)],'k:');    set(h,'UserData','y axis')    hold off  else    hdl_child = allchild(hdlfig);    delete(findobj(hdl_child,'UserData','y axis'))  end  if Fig.line, fm_plot('createlinelist'), end case 'axescolor'  currentColor = get(hdlfig,'Color');  c = uisetcolor(currentColor);  if ~isequal(c,currentColor) set(hdlfig,'Color',c);    hdl_line = findobj(allchild(hdlfig),'Type','line');    set(hdl_line,'MarkerFaceColor',c)    hlegend = findobj(Fig.plot,'Tag','legend');    set(hlegend,'Color',c)  end case 'axesx'  if get(hdl_y,'Value')    set(hdl_y,'Value',0)    delete(findobj(allchild(hdlfig),'UserData','y axis'))  end  if get(hdl_xy,'Value')    set(hdl_xy,'Value',0)    delete(findobj(allchild(hdlfig),'UserData','y axis'))    delete(findobj(allchild(hdlfig),'UserData','x axis'))  end  value = get(gcbo,'Value');  if value    xlim = get(hdlfig,'XLim');    hold on    h = plot([xlim(1), xlim(2)], [0, 0],'k:');    set(h,'UserData','x axis')    hold off  else    hdl_child = allchild(hdlfig);    delete(findobj(hdl_child,'UserData','x axis'))  end  if Fig.line, fm_plot('createlinelist'), end case 'axesxy'  if get(hdl_x,'Value')    set(hdl_x,'Value',0)    delete(findobj(allchild(hdlfig),'UserData','x axis'))  end  if get(hdl_y,'Value')    set(hdl_y,'Value',0)    delete(findobj(allchild(hdlfig),'UserData','y axis'))  end  value = get(gcbo,'Value');  if value    xlim = get(hdlfig,'XLim');    ylim = get(hdlfig,'YLim');    hold on    h = plot([xlim(1), xlim(2)], [0, 0],'k:');    set(h,'UserData','x axis')    h = plot([0, 0],[ylim(1), ylim(2)],'k:');    set(h,'UserData','y axis')    hold off  else    hdl_child = allchild(hdlfig);    try, delete(findobj(hdl_child,'UserData','x axis')), end    try, delete(findobj(hdl_child,'UserData','y axis')), end  end  if Fig.line, fm_plot('createlinelist'), end case 'zoomx'  zoom xon  set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion');  set(hdl_zoom1,'Value',0);  set(hdl_zoom3,'Value',0);  if get(hdl_zoom2,'Value')    Settings.zoom = 'zoom xon';  else    Settings.zoom = '';    zoom off  end case 'zoomxy'  zoom on  set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion');  set(hdl_zoom2,'Value',0);  set(hdl_zoom3,'Value',0);  if get(hdl_zoom1,'Value')    Settings.zoom = 'zoom on';  else    Settings.zoom = '';    zoom off  end case 'moveup'  value = get(Hdl_listplot,'Value');  NameString = get(Hdl_listplot,'String');  Value = 1:length(NameString);  if value > 1    dummy = Varname.pos(value);    Varname.pos(value) = Varname.pos(value-1);    Varname.pos(value-1) = dummy;    dummy = Value(value);    Value(value) = Value(value-1);    Value(value-1) = dummy;    set(Hdl_listplot, ...        'String',NameString(Value), ...        'Value',value-1);  end case 'movedown'  value = get(Hdl_listplot,'Value');  NameString = get(Hdl_listplot,'String');  Value = 1:length(NameString);  if value < length(Varname.pos) & ~isempty(NameString)    dummy = Varname.pos(value);    Varname.pos(value) = Varname.pos(value+1);    Varname.pos(value+1) = dummy;    dummy = Value(value);    Value(value) = Value(value+1);    Value(value+1) = dummy;    set(Hdl_listplot, ...        'String',NameString(Value), ...        'Value',value+1);  end case 'togglegrid'  if get(gcbo,'Value'),    grid on,  else,    grid off,  end case 'togglelegend'  if Settings.hostver >= 7    legend(Hdl.axesplot,'toggle')  else    onoff = {'off','on'};    if strcmp(get(gcbo,'Tag'),'PushLegend')      set(Hdl_legend,'Value',~get(Hdl_legend,'Value'))      set(gcbo,'Checked',onoff{get(Hdl_legend,'Value')+1})      value = get(Hdl_legend,'Value');    else      hdl = findobj(Fig.plot,'Tag','PushLegend');      set(hdl,'Checked',onoff{get(gcbo,'Value')+1})      value = get(gcbo,'Value');    end    if value      fm_plot('plotvars')    else      legend off    end  end case 'listvars'  Value = get(Hdl_listvar,'Value');  if isempty(Value), return, end  NameString = get(Hdl_listvar,'String');  if isempty(NameString), return, end  set(Hdl_listplot,'String',NameString(Value));  set(Hdl_listplot,'Value',1);  Varname.pos = 1:length(Value);  if strcmp(get(Fig.plot,'SelectionType'),'open'),    fm_plot('plotvars')  end case 'listlines'  hdl = findobj(Fig.line,'Tag','Listbox1');  Value = get(hdl,'Value');  hdl_line = get(Fig.line,'UserData');  hdl_line = hdl_line(end:-1:1);  n_var = length(get(Hdl_listplot,'String'));  fm_linedlg(hdl_line(Value)) case 'createlinelist'  hdl_line = findobj(allchild(hdlfig),'Type','line');  variabili = get(Hdl_listplot,'String');  set(Fig.line,'UserData',hdl_line);  hdl_list = findobj(Fig.line,'Tag','Listbox1');  line_string = cell(length(hdl_line),1);  hdl_line = hdl_line(end:-1:1);  for i = 1:length(hdl_line)    if strcmp(get(hdl_line(i),'UserData'),'x axis')      line_string{i,1} = ['x axis ',fvar(i,4)];    elseif strcmp(get(hdl_line(i),'UserData'),'y axis')      line_string{i,1} = ['y axis ',fvar(i,4)];    elseif i <= length(variabili)      line_string{i,1} = ['line   ',fvar(i,4),variabili{i}];    else      line_string{i,1} = ['symbol ',fvar(i,4), ...                          variabili{i-length(variabili)}];    end  end  set(hdl_list,'String',line_string,'Value',1); case 'axesprops'  fm_axesdlg(hdlfig) case 'textprops'  TextProp = uisetfont;  if isstruct(TextProp)    set(hdlfig,TextProp)    set(get(hdlfig,'XLabel'),TextProp)    set(get(hdlfig,'YLabel'),TextProp)    set(get(hdlfig,'Title'),TextProp)    if get(Hdl_legend,'Value')      hlegend = findobj(Fig.plot,'Tag','legend');      hchild = get(hlegend,'Child');      set(hchild(end), ...          'FontName',TextProp.FontName, ...          'FontWeight', TextProp.FontWeight, ...          'FontAngle',TextProp.FontAngle)    end  end case 'setxlabel'  value = get(gcbo,'Value');  set(gcbo,'Value',value(end))  if strcmp(get(Fig.plot,'SelectionType'),'open')    fm_plot('plotvars')  end case 'setangles'  global COI  idx = [];  kdx = [];  for i = 1:length(Varout.idx)    kkk = Varout.idx(i);    if kkk > DAE.n+DAE.m      break    elseif kkk <= DAE.n      if ifdelta(Syn, kkk)        idx = [idx, kkk];        kdx = [kdx, i];      end    elseif kkk > DAE.n & kkk <= DAE.n+Bus.n      idx = [idx, kkk];      kdx = [kdx, i];    elseif ifdelta(COI,kkk)      idx = [idx, kkk];      kdx = [kdx, i];    end  end  set(gcbo, ...      'String',[{'None'}; Varname.uvars(idx)], ...      'UserData',kdx) case 'limits'  status = get(gcbo,'Checked');  switch status   case 'on'    set(gcbo,'Checked','off')   case 'off'    set(gcbo,'Checked','on')  end  fm_plot plotvars case 'plotvlims'  hdl = findobj(Fig.plot,'Tag','PlotVLim');  value = get(hdl,'Checked');  if ~strcmp(value,'on'), return, end  xlimits = get(hdlfig,'XLim');  hold on  plot(hdlfig,[xlimits(1) xlimits(2)],[0.9 0.9],'k:')  plot(hdlfig,[xlimits(1) xlimits(2)],[1.1 1.1],'k:')  hold off case 'plotslims'  hdl = findobj(Fig.plot,'Tag','NormSij');  value = get(hdl,'Checked');  if ~strcmp(value,'on'), return, end  xlimits = get(hdlfig,'XLim');  hold on  plot(hdlfig,[xlimits(1) xlimits(2)],[1.0 1.0],'k:')  hold off case 'lowestv'  idx = find(Varname.idx > DAE.n+Bus.n & Varname.idx <= DAE.n+2*Bus.n);  if isempty(idx), return, end  out = Varout.vars(:,idx);  vals = min(out,[],1);  [y,jdx] = sort(vals);  if length(jdx) > 3, jdx = jdx(1:3); end  set(Hdl_listvar,'Value',idx(jdx));  fm_plot listvars  fm_plot plotvars case 'highestv'  idx = find(Varname.idx > DAE.n+Bus.n & Varname.idx <= DAE.n+2*Bus.n);  if isempty(idx), return, end  out = Varout.vars(:,idx);  vals = max(out,[],1);  [y,jdx] = sort(vals,2,'descend');  if length(jdx) > 3, jdx = jdx(1:3); end  set(Hdl_listvar,'Value',idx(jdx));  fm_plot listvars  fm_plot plotvars case 'highests'  values = highests(Line);  if isempty(values), return, end  set(Hdl_listvar,'Value',values);  fm_plot listvars  fm_plot plotvarsendif ~isempty(Settings.zoom), eval(Settings.zoom), end% ------------------------------------------------------------------------% Enumeration of variables% ------------------------------------------------------------------------function stringa = enum(stringa)for i = 1:length(stringa),  stringa{i} = ['[',int2str(i),'] ',stringa{i}];end

⌨️ 快捷键说明

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