How do I Generate a Spectrogram in AppDesigner based on Simulink?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello all, I am a beginner in MATLAB/ Simulink/ AppDesigner and I will really appriciate if anyone can shed some light onto my troubles here.
Bascailly, I am trying to create a simple GUI through AppDesigner which consist primarily of a Spectrogram. I have a mono audio file that after some proceessing, have passed through the Cepstral Feature Extrator block to obtain the features. The data of the spectrogram is obtained through a "To Workspace" block that I have directly attached to the output of the Cepstral Feature Extractor block in Simulink. My main objective here is to simply display the same output that I'm observing in the Spectrum Analyzer's Spectrogram view in Simulink, in AppDesigner.
If it's of any help, the output of the "To Workspace" block is a 14x1x469 double value.
I've tried a variety of methods to perform as such but unsuccessful. Any help here will be really appreciated. If possible, do guide me through step by step as I'm unfamiliar with the software. Thanks.
0 comentarios
Respuestas (1)
Harsh Mahalwar
el 22 de Feb. de 2024
Hi Schubert,
As I can understand you are trying to display the same output that you are observing in the spectrum analyser’s spectrogram view in Simulink, in App designer.
You can use the spectrumAnalyzer function with some name value arguments to achieve the same.
Here’s an example: (I have changed this example to show the output in spectrogram view)
sin = dsp.SineWave(Frequency=100,SampleRate=1000, SamplesPerFrame=1000);
scope = spectrumAnalyzer(SampleRate=sin.SampleRate, ViewType="spectrogram");
for ii = 1:250
x = sin() + 0.05*randn(1000,1);
scope(x);
end
The above script is an example from the spectrumAnalyzer function’s documentation that you can find here,
One thing important thing to remember here is that I have used the viewType name value argument to achieve the spectrogram view. You can learn more about all the name value arguments of spectrumAnalyzer from the above documentation.
You can use this script in your app as well, here’s an example on how you can add this feature to your own MATLAB app:
You can add a button in your MATLAB app and add a callback with your button.
To add callbacks to your application components, you can refer the following documentation,
Here, you can see that I have again added the code from spectrumAnalyzer’s documentation example.
After clicking the “call spectrum analyzer” button (when you’re app is running), you’ll see the spectrum analyzer pop-up in spectrogram view.
I hope this helps, thanks!
0 comentarios
Ver también
Categorías
Más información sobre Feature Extraction en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!