From: Haitham Tahbub on
i am trying to implement the function that i used to compute the specgram in the matlab code:-

r =specgram(ref,512,384,hann(512),256);

into the Simulink Blocks and i want to know what is the equivelent bolcks i must use that do the same function as this line of code .

Please Help Me with information about the needed blocks and how the connection of them and what the parameters of them must be to be equivelent to the line of code above .

Thanks
Regards.
From: Wayne King on
"Haitham Tahbub" <the_mummy_n1(a)hotmail.com> wrote in message <hr7hap$ckn$1(a)fred.mathworks.com>...
> i am trying to implement the function that i used to compute the specgram in the matlab code:-
>
> r =specgram(ref,512,384,hann(512),256);
>
> into the Simulink Blocks and i want to know what is the equivelent bolcks i must use that do the same function as this line of code .
>
> Please Help Me with information about the needed blocks and how the connection of them and what the parameters of them must be to be equivelent to the line of code above .
>
> Thanks
> Regards.

Hi Haitham, do you have the Signal Processing Blockset? If so, you can implement your call to specgram (specgram is being obsoleted by the way, you should consider switching your code to spectrogram) with a combination of the window function and the Short-time FFT blocks. In the transforms library, there is a Short-time FFT block. In that block you can set the analysis window length, overlap, and FFT length. Also, in the Signal Operations library, there is a window function block. In that block, you can select the Hann window.

Hope that helps,
Wayne
From: Haitham Tahbub on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hr7ino$geq$1(a)fred.mathworks.com>...
> "Haitham Tahbub" <the_mummy_n1(a)hotmail.com> wrote in message <hr7hap$ckn$1(a)fred.mathworks.com>...
> > i am trying to implement the function that i used to compute the specgram in the matlab code:-
> >
> > r =specgram(ref,512,384,hann(512),256);
> >
> > into the Simulink Blocks and i want to know what is the equivelent bolcks i must use that do the same function as this line of code .
> >
> > Please Help Me with information about the needed blocks and how the connection of them and what the parameters of them must be to be equivelent to the line of code above .
> >
> > Thanks
> > Regards.
>
> Hi Haitham, do you have the Signal Processing Blockset? If so, you can implement your call to specgram (specgram is being obsoleted by the way, you should consider switching your code to spectrogram) with a combination of the window function and the Short-time FFT blocks. In the transforms library, there is a Short-time FFT block. In that block you can set the analysis window length, overlap, and FFT length. Also, in the Signal Operations library, there is a window function block. In that block, you can select the Hann window.
>
> Hope that helps,
> Wayne


Thanks Wayne
But i tried what you told me , but when i input a signal from the workspace that has a dimension of " 1X21893 " i am surprized that the output of this FFt block is a vector of 512X1 that all eleements has a zero values ....
why ???
what is the problem???

Please help Me
if you want me to attach the links of the pictures tell me

waiting for your reply
From: Wayne King on
"Haitham Tahbub" <the_mummy_n1(a)hotmail.com> wrote in message <hr7p28$ejp$1(a)fred.mathworks.com>...
> "Wayne King" <wmkingty(a)gmail.com> wrote in message <hr7ino$geq$1(a)fred.mathworks.com>...
> > "Haitham Tahbub" <the_mummy_n1(a)hotmail.com> wrote in message <hr7hap$ckn$1(a)fred.mathworks.com>...
> > > i am trying to implement the function that i used to compute the specgram in the matlab code:-
> > >
> > > r =specgram(ref,512,384,hann(512),256);
> > >
> > > into the Simulink Blocks and i want to know what is the equivelent bolcks i must use that do the same function as this line of code .
> > >
> > > Please Help Me with information about the needed blocks and how the connection of them and what the parameters of them must be to be equivelent to the line of code above .
> > >
> > > Thanks
> > > Regards.
> >
> > Hi Haitham, do you have the Signal Processing Blockset? If so, you can implement your call to specgram (specgram is being obsoleted by the way, you should consider switching your code to spectrogram) with a combination of the window function and the Short-time FFT blocks. In the transforms library, there is a Short-time FFT block. In that block you can set the analysis window length, overlap, and FFT length. Also, in the Signal Operations library, there is a window function block. In that block, you can select the Hann window.
> >
> > Hope that helps,
> > Wayne
>
>
> Thanks Wayne
> But i tried what you told me , but when i input a signal from the workspace that has a dimension of " 1X21893 " i am surprized that the output of this FFt block is a vector of 512X1 that all eleements has a zero values ....
> why ???
> what is the problem???
>
> Please help Me
> if you want me to attach the links of the pictures tell me
>
> waiting for your reply

Hi Haitham, I did a simple model where I attached a "Signal from workspace" block to the x[n] port on the Short-time FFT block and a window function block to the w[n] port and then output the data into the MATLAB workspace with a "Signal to Workspace" sink.

It works fine for me. Why don't you mail me your .mdl file and I'll look at your mask parameters. I won't get a chance to look at it until tomorrow.

You can look at the dspstsa_win32 demo in the meantime. It's a little more complicated than what you need but it has the crux of the material in it.

Wayne
Wayne
From: Wayne King on
"Haitham Tahbub" <the_mummy_n1(a)hotmail.com> wrote in message <hr7p28$ejp$1(a)fred.mathworks.com>...
> "Wayne King" <wmkingty(a)gmail.com> wrote in message <hr7ino$geq$1(a)fred.mathworks.com>...
> > "Haitham Tahbub" <the_mummy_n1(a)hotmail.com> wrote in message <hr7hap$ckn$1(a)fred.mathworks.com>...
> > > i am trying to implement the function that i used to compute the specgram in the matlab code:-
> > >
> > > r =specgram(ref,512,384,hann(512),256);
> > >
> > > into the Simulink Blocks and i want to know what is the equivelent bolcks i must use that do the same function as this line of code .
> > >
> > > Please Help Me with information about the needed blocks and how the connection of them and what the parameters of them must be to be equivelent to the line of code above .
> > >
> > > Thanks
> > > Regards.
> >
> > Hi Haitham, do you have the Signal Processing Blockset? If so, you can implement your call to specgram (specgram is being obsoleted by the way, you should consider switching your code to spectrogram) with a combination of the window function and the Short-time FFT blocks. In the transforms library, there is a Short-time FFT block. In that block you can set the analysis window length, overlap, and FFT length. Also, in the Signal Operations library, there is a window function block. In that block, you can select the Hann window.
> >
> > Hope that helps,
> > Wayne
>
>
> Thanks Wayne
> But i tried what you told me , but when i input a signal from the workspace that has a dimension of " 1X21893 " i am surprized that the output of this FFt block is a vector of 512X1 that all eleements has a zero values ....
> why ???
> what is the problem???
>
> Please help Me
> if you want me to attach the links of the pictures tell me
>
> waiting for your reply

Hi Haitham, two issues with your model:

1.) the From wave file block is obsolete, you should use the From multimedia file block.
2.) You were running the simulation much longer than the length of your data, that is why you ended up with all those zeros at the end. Use the "Inherit sample time" from
file option on the From multimedia file block, and then run the simulation time only as long as need be.

Hope that helps,
Wayne