Plotting into Multiple Axes in GUI

2 visualizaciones (últimos 30 días)
Samuel Leeney
Samuel Leeney el 16 de Oct. de 2020
Respondida: J. Alex Lee el 16 de Oct. de 2020
I am writing a signal generater where a number of different user controlled signals are varied and then fourier transformed.
I am unable to determine which axes the signals are plotted into. They default into the first axes. I have tried using 'axes(handles.SignalAxes)' but it returns an error message.
See the photo of my basic gui and an extract from the code. I need the 'fourier transform' part of the code to plot into the second of the four axes.
Thanks in advance
function Frequency_Callback(hObject, eventdata, handles)
% hObject handle to Frequency (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
f = get(hObject,'Value');
assignin('base','f',f);
setappdata(0,'f',f);
updateAll()
%there is an identical function for each of the four sliers
function updateAll
f=round(getappdata(0,'f'));
S_rate=round(getappdata(0,'S_rate'));
t=round(getappdata(0,'t'));
phi=round(getappdata(0,'phi'));
Sin_Wave(f,phi,S_rate,t)
%Fourier transform
signal = Sin_Wave(f,phi,S_rate,t);
t=linspace(0,t,S_rate);
n=length(t);
fft1 = fft(signal,n);
PSD = (fft1.*conj(fft1))./n;
freq = 1/(n.*0.0101)*(0:n);
L = 1:floor(n/2);
%axes(handles.SignalAxes) %this function results in an error message
loglog(freq(L),PSD(L)) %this should plot into the second figure in the GUI, but it does not

Respuesta aceptada

J. Alex Lee
J. Alex Lee el 16 de Oct. de 2020
Any plot command can accept as a first argument a target axes object to plot into.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by