Matlab - Problema con los gráficos en una gui de matlab

 
Vista:
sin imagen de perfil

Problema con los gráficos en una gui de matlab

Publicado por Hector (15 intervenciones) el 10/01/2014 19:54:03
Muy buenas tardes,

tengo un problema al graficar una curva en una gui de matlab. Además del gráfico, los resultados de los cálculos para hacer el gráfico se muestran al lado del mismo. Afortunadamente los cálculos muestran los valores correctos, pero sigo sin poder graficar la curva.

Os adjunto mi código y agradezco cualquier colaboración que me pudieseis brindar,

Saludos cordiales,

Héctor


function Third_Essay_Plot (varargin)

close all
clear all
clc

figure_color=[0.99 0.99 0.99];
panel_color=[1 1 1];

hFigure= figure('MenuBar','none',...
'Units','Pixels',...
'Color',figure_color,...
'Toolbar','none',...
'Name','Model',...
'resize','off',...
'NumberTitle','off',...
'Position',[1 800 1280 683]);

hg=uitabgroup('Parent',hFigure,...
'units','pixels','position',...
[1.5 10 1277 677]);

%------------------------------------------------------Tabs----------------------------------------------------------------%
ht(3)=uitab(hg,'Title','Single Event Transients');
%-----------------------------------------------------Panels----------------------------------------------------------------

hPanelC = uipanel(...
'Title','',...
'Fontsize',22,...
'Parent', ht(3),...
'Units','Pixels',...
'BorderWidth',3,...
'Position',[1 1.9 1263 328],...
'BackgroundColor',panel_color);

%## SETs Sub Panels

hSETsPanel1 = uipanel('Parent',ht(3),'Units',...
'pixels','Title','SET Pulse Determination',...
'Fontsize',14,'BackgroundColor',[1 1 1],...
'Position',[5.5 126 1176 158],'BorderWidth',2);

hSETsPanel2 = uipanel('Parent',hSETsPanel1,'Units',...
'pixels','Title','Results SET Pulse','Fontsize',...
14,'BackgroundColor',[1 1 1],'Position',...
[615 5 520 136],'BorderWidth',1);

hSETsSubPanel1 = uipanel('Parent',hSETsPanel2,'Units',...
'pixels','Title','Tuner :D','Fontsize',10,...
'BackgroundColor',[1 1 1 ],'Position',...
[415.5 2.75 93 37],'BorderWidth',1);


%##### SETs Analysis Plots--------

hSETsGraph1 = axes('Parent',hSETsPanel2,'Units',...
'pixels','Position',[42 17 290 90],'Color',[1 1 1]);

%-------------------------------------------------SET Tuner frames-----------------------------------------------------------------

hcolorPopupSET = uicontrol('Parent',hSETsSubPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],'FontSize',12,...
'ForegroundColor',[0 0 0],'Position',[0.07 0.81 0.88 0.12],...
'String',{ 'Color'; 'Red'; 'Yellow'; 'Green'; 'Blue'; 'Magenta'; 'Black'; },...
'Style','popupmenu','Value',1,'Callback',@colorPopupSET_Callback);

hlineStylePopupSET = uicontrol('Parent',hSETsSubPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],'FontSize',12,...
'ForegroundColor',[0 0 0],'Position',[0.07 0.50 0.88 0.12],...
'String',{ 'Line'; 'Solid'; 'Dotted'; 'Dashed'; 'DotDash'; 'none' },...
'Style','popupmenu','Value',1,'Callback',@lineStylePopupSET_Callback);

hlineWidthEditBoxSET = uicontrol('Parent',hSETsSubPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],'FontSize',12,'ForegroundColor',...
[0 0 0],'Position',[0.59 0 0.35 0.32],'String','','Style','edit',...
'Callback',@lineWidthEditBoxSET_Callback);

hLineWidthSET = uicontrol('Parent',hSETsSubPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],'FontSize',12,...
'ForegroundColor',[0 0 0],'HorizontalAlignment','left',...
'Position',[0.10 0.09 0.495 0.18],'String','L.Width:','Style','text');


%---------------------------------- Input SET Pulse Determination/Parameter Panel-

hLetSETlabel = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',18,'ForegroundColor',[0 0 0],...
'HorizontalAlignment','left','Position',[0.005 0.76 0.35 0.17],...
'String','Linear Energy Transfer:','Style','text');

hLetSETInput = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',16,'ForegroundColor',[0 0 0],...
'Position',[0.19 0.845 0.11 0.10],'String','','Style','edit');

%############Input SET Charge Collection Depth Radiation data/Parameter Panel-

hDepthSETlabel = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',18,'ForegroundColor',[0 0 0],...
'HorizontalAlignment','left','Position',[0.005 0.66 0.35 0.17],...
'String','Charge Coll Depth :','Style','text');

hDepthSETInput = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',16,'ForegroundColor',[0 0 0],...
'Position',[0.15 0.745 0.11 0.10],...
'String','','Style','edit');

%############Input SET Charge deposited/Parameter Panel-

hCdepoSETlabel = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',18,'ForegroundColor',[0 0 0],...
'HorizontalAlignment','left','Position',[0.005 0.56 0.35 0.17],...
'String','Charge deposited (fC) :','Style','text');

hCdepoSETInput = uicontrol('Parent',hSETsPanel1,...
'Units','normalized','BackgroundColor',[1 1 1],...
'FontSize',16,'ForegroundColor',[0 0 0],...
'Position',[0.18 0.645 0.11 0.10],...
'String','','Style','edit');

%############Input Time SET /Parameter Panel-

hTimeSETlabel = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',18,'ForegroundColor',[0 0 0],...
'HorizontalAlignment','left','Position',...
[0.005 0.46 0.35 0.17],'String','Time (ns):','Style','text');

hTimeSETInput = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',16,'ForegroundColor',[0 0 0],...
'Position',[0.08 0.545 0.11 0.10],...
'String','','Style','edit');

%######## SET Event Transient Analysis Push Buttons---

hSETMainPushButton = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','Position',[0.10 0.30 0.20 0.18],'Style','Pushbutton',....
'String',' Run!','FontSize',25,'Callback',@SETMainPushButton_Callback);

hSETInfoPushButton = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','Position',[0.20 0.13 0.20 0.18],'Style','Pushbutton',...
'String',' Info','FontSize',25,'foregroundColor','r','Callback',...
@SETInfoPushButton_Callback);

%%%%% TID Analysis reset Push Button%%%%
hSETResetPushButton = uicontrol('Parent',hSETsPanel1,'Units',...
'normalized','Position',[0 0.13 0.20 0.18],'Style',...
'Pushbutton','String',' Reset','FontSize',25,...
'foregroundColor','g','Callback',@SETResetPushButton_Callback);

%######### SETs Results frame--

hISETlabel = uicontrol('Parent',hSETsPanel2,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',18,'ForegroundColor',[0 0 0],...
'HorizontalAlignment','left','Position',...
[0.78 0.89 0.15 0.12],'String','I(t):','Style','text');

hISETOutput = uicontrol('Parent',hSETsPanel2,'Units',...
'normalized','BackgroundColor',[1 1 1],...
'FontSize',10,'ForegroundColor',[0 0 0],...
'Position',[0.85 0.907 0.14 0.11],'String','','Style','edit');

hQcollSETlabel = uicontrol('Parent',hSETsPanel2,'Units',...
'normalized','BackgroundColor',[1 1 1],'FontSize',...
18,'ForegroundColor',[0 0 0],'HorizontalAlignment',...
'left','Position',[0.72 0.76 0.15 0.12],...
'String','Qcoll:','Style','text');

hQcollSETOutput = uicontrol('Parent',hSETsPanel2,'Units',...
'normalized','BackgroundColor',[1 1 1],'FontSize',10,...
'ForegroundColor',[0 0 0],'Position',[0.85 0.775 0.14 0.11],...
'String','','Style','edit');


handle_list=...
[hFigure,hg,ht(3),hPanelC,hSETsPanel1,hSETsPanel2,...
hSETsSubPanel1,hSETsGraph1,hcolorPopupSET,hlineStylePopupSET,...
hlineWidthEditBoxSET,hLineWidthSET,hLetSETlabel,hLetSETInput,...
hDepthSETlabel,hDepthSETInput,hCdepoSETlabel,hCdepoSETInput,...
hTimeSETlabel,hTimeSETInput,hSETMainPushButton,hSETInfoPushButton,...
hSETResetPushButton,hISETlabel,hISETOutput,hQcollSETlabel,...
hQcollSETOutput];
set(handle_list,...
'Units','normalized');

%------------------------------------------------------- SETs EVALUATION FUNCTION ------------------------------

% % --- Executes on button press in SET Transient pulse.
function SETMainPushButton_Callback(hObject, eventdata)

LET = str2double(get(hLetSETInput,'string')); %Linear Energy Transfer

Depth = str2double(get(hDepthSETInput,'string')); %2um.MeV^-1

t = str2double(get(hTimeSETInput,'string')); %Time in ns

Ch = str2double(get(hCdepoSETInput,'string')); %Charge deposited

Qc =(Ch.*Depth.*LET).*(1e-15);

ta = 1.64.*10.^-10;%Collection time constant

tb = 5.*10.^-11;%Ion track establishment time

it =((Qc./(ta-tb)).*(exp(-t.*10.^-9./ta)- exp(-t.*10.^-9./tb)));

set(hQcollSETOutput,'string',num2str(Qc));

set(hISETOutput,'string',num2str(it));

%ts = 0:0.05:t;
axes(hSETsGraph1);
plot(t,it,'r','linewidth',1);
title ('Plot inicial','FontName','Helvetica','FontSize', 10);
xlabel ('tiempo','FontName','Helvetica','FontSize', 10);
ylabel ('SET','FontName','Helvetica','FontSize', 10);
legend('SET Pulse','location','NorthEast');
set(gca,'FontSize',10,'linewidth',1.5)
set(gcf,'color','w');
grid on
end

% --- Executes on button press in SETreset_button.
function SETResetPushButton_Callback(hObject, eventdata)
set(hLetSETInput,'String','');set(hDepthSETInput,'String','');set(hTimeSETInput,'String','');set(hCdepoSETInput,'String','')
set(hQcollSETOutput,'String','');set(hISETOutput, 'string','');set(hCrSECSETInput, 'string','')
end


function colorPopupSET_Callback(hObject,eventdata)
colors=get(hcolorPopupSET,'string');
index=get(hcolorPopupSET,'value');
color=colors{index};
switch color
case 'Red'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'color','r')
case 'Blue'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'color','b')
case 'Yellow'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'color','y')
case 'Green'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'color','g')
case 'Magenta'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'color','m')
case 'Black'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'color','k')
end
end

function lineStylePopupSET_Callback(hObject,eventdata)
styles=get(hlineStylePopupSET,'string');
index=get(hlineStylePopupSET,'value');
linestyle=styles{index};
switch linestyle
case 'Solid'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'linestyle','-')
case 'Dotted'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'linestyle',':')
case 'Dashed'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'linestyle','--')
case 'DotDash'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'linestyle','-.')
case 'none'
h=findobj(hSETsGraph1,'Tag','Plot');set(h,'linestyle','none')
end
end

function lineWidthEditBoxSET_Callback(hObject,eventdata)
width=str2double(get(hlineWidthEditBoxSET,'string'));
h=findobj(hSETsGraph1,'Tag','Plot'); set(h,'linewidth',width)
end

end
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder