Hello everyone,
So, I want to plot some graphs in my GUI, but using the same axes object. And then, I'll have two buttons to navigate between the figures. Something like what is shown in the fig below.
Any ideas on how to do this?
I tried creating a sequence with all the graphs that will be created, and assign a signal to the two buttons of the fig. above (-1 and 1).
function manageGraphs(handles, hObject, sinal)% Define the sequences of graphs, for each topology
sequence = {'perdas_ripple', 'volume_ripple', ... 'perdas_fsw','volume_fsw', ... 'pareto_ripple', 'pareto_fsw'};dim_sequence = length(sequence);start_graphs = 1;end_graphs = 6;% Get the current index_sequence from handles
index_sequence = 4;fsw = handles.fsw;delta_i = handles.delta_i;if (sinal == -1) % If the user pressed the left button, i.e., sinal = -1
if(index_sequence ~= start_graphs) % If the user did not reach the first element
% index_sequence ~= start_current_graphs
% Sweep to the previous graph, if the user did not reach the
% beginning of the list
index_sequence = index_sequence + sinal; else % index_sequence == start_losses_graphs
% If the user reaches the start, returns to the end
index_sequence = end_graphs; end % If the sequence ends, return to the start
elseif sinal == 1 % If the user pressed the right button, i.e., sinal = 1
if(index_sequence ~= end_graphs) index_sequence = index_sequence + sinal; else % If the user reached the last element in the sequence of graphs
% of losses, returns to the start of this list
index_sequence = start_graphs; endendseq = sequence{index_sequence};% Make 'grafico_corrente' the current graph
axes(handles.graphs);% Plot the graphs
switch seq case 'perdas_ripple' plot(handles.x_ripple, handles.PerdasT_ripple); hold on; plot(handles.x_ripple, handles.PerdasL_ripple); hold on; plot(handles.x_ripple, handles.PerdasTotais_ripple); xlabel('Ripple de Corrente'); ylabel('Perdas [W]'); title('Perdas nos Transistores, Indutores e Totais'); legend('Perdas nos Transistores', 'Perdas nos Indutores', 'Perdas Totais'); case 'volume_ripple' plot(handles.x_ripple, handles.VolL_ripple); hold on; plot(handles.x_ripple, handles.VolHS_ripple); hold on; plot(handles.x_ripple, handles.VolumeTotal_ripple); xlabel('Ripple de Corrente'); ylabel('Volume [dm³]'); % Verificar se é dm³ msm
title('Volume dos Indutores, Dissipadores e Total'); legend('Volume dos Indutores', 'Volume dos Dissipadores', 'Volume Total'); case 'perdas_fsw' plot(handles.x_fsw, handles.PerdasT_fsw); hold on; plot(handles.x_fsw, handles.PerdasL_fsw); hold on; plot(handles.x_fsw, handles.PerdasTotais_fsw); xlabel('Frequência de Chaveamento'); ylabel('Perdas [W]'); title('Perdas nos Transistores, Indutores e Totais'); legend('Perdas nos Transistores', 'Perdas nos Indutores', 'Perdas Totais'); case 'volume_fsw' plot(handles.x_fsw, handles.VolL_fsw); hold on; plot(handles.x_fsw, handles.VolHS_fsw); hold on; plot(handles.x_fsw, handles.VolumeTotal_fsw); xlabel('Frequência de Chaveamento'); ylabel('Volume [dm³]'); % Verificar se é dm³ msm title('Volume dos Indutores, Dissipadores e Total'); legend('Volume dos Indutores', 'Volume dos Dissipadores', 'Volume Total'); case 'pareto_ripple' for k = 1 : length(delta_i) plot(handles.DenPot(k,1:end), handles.Rend(k,1:end)); hold on; legend("Ripple = " + delta_i(k)); end xlabel('Densidade de Potência [kW/dm³]'); ylabel('Rendimento'); title('Rendimento x Densidade de Potência - Diferentes Ripples'); case 'pareto_fsw' for k = 1 : length(fsw) plot(handles.DenPot(:,k), handles.Rend(:,k)); hold on; legend("Fsw = " + fsw(k) + "kHz"); end xlabel('Densidade de Potência [kW/dm³]'); ylabel('Rendimento'); title('Rendimento x Densidade de Potência - Diferentes Fsw'); endend
obs.: Is it correct how I made the plot loops and the legends of the two last cases (pareto_ripple and pareto_fsw) ?
Thanks in advance!
Best Answer