how can i plot stft in app designer

5 Ansichten (letzte 30 Tage)
Taha
Taha am 29 Okt. 2022
Beantwortet: Kevin Holly am 31 Okt. 2022
i want to plot the stft in a axis in app designer but its showing an error
hers is the code
[y,Fs] = audioread(app.PathofaudiofileEditField.Value);
y = fmmod(y,freq,1000,100);
plot(app.UIAxes_3,y);
stft(app.UIAxes2,y,Fs,'Window',kaiser(1024,5),'OverlapLength',220,'FFTLength',4096);
colormap jet
view(-45,65 , 'parent',app.UIAxes2)
colormap jet

Antworten (1)

Kevin Holly
Kevin Holly am 31 Okt. 2022
Below is a workaround to get the stft plot into your UIAxes. Please see app attached.
freq= 30;
[y,Fs] = audioread('handel_audio.wav');
y = fmmod(y,freq,1000,100);
plot(app.UIAxes,y);
stft(y,Fs,'Window',kaiser(1024,5),'OverlapLength',220,'FFTLength',4096);
h = gca;
app.UIAxes2.XLabel = h.XLabel;
app.UIAxes2.YLabel = h.YLabel;
app.UIAxes2.Title = h.Title;
app.UIAxes2.XLim = h.XLim;
app.UIAxes2.YLim = h.YLim;
for ii = length(h.Children):-1:1
h.Children(ii).Parent = app.UIAxes2;
end
cb = colorbar(app.UIAxes2);
ylabel(cb,"Magnitude (dB)")
colormap(app.UIAxes2,'jet')
view(app.UIAxes2,-45,65)
close(gcf)

Kategorien

Mehr zu Simulation, Tuning, and Visualization finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by