Simulkink FFT Shift block

17 ビュー (過去 30 日間)
Katherine
Katherine 2024 年 8 月 5 日
回答済み: Rahul 2024 年 8 月 7 日
Is there a simulink block that replicates the fftshift function. Bonus points if it is hdl

回答 (4 件)

Amish
Amish 2024 年 8 月 6 日
Hi Katherine,
The fftshift can be replicated in Simulink using a combination of "FFT Block" and "Premute" blocks.
The "FFT block" from the DSP HDL Toolbox provides architectures optimized for FPGA and ASIC application. You can configure the FFT block for your specific requirements and then use the "Permute" block to shift the FFT output to match the fftshift behavior.
Ensure that the "Output in bit-reversed order" option is unchecked, as we need a linear order for the fftshift.
The "FFT block" supports HDL Code Generation using the HDL Coder.
More information can be found in thew following documentation:
Hope this helps!

Sahas
Sahas 2024 年 8 月 6 日
There is no exact block in Simulink that replicates the “fftshift” function of MATLAB. However, it is possible to create a Subsystem in Simulink that performs the same operations to achieve the same output as “fftshift” function for a 1-D vector by first splitting the vector into two halves, and then reordering the halves.
“Selector” and “Matrix Concatenate” blocks can be used for this purpose. Follow the steps given below to make the required Subsystem:
  1. Load the input vector in MATLAB base workspace.
  2. Define variables to determine the length of the vector and the middle index of the vector.
  3. Configure the Block Parameters of “Selector” block as given below.
  4. Arrange the required blocks in Simulink to get the desired output.
  5. This example is for a 1-D vector. Adjustments can be made based on specific requirements. After we get the desired output according to our specifications, we can convert it into a Subsystem.
  6. Remove all the “Display” blocks and select the “Selector” and the “Matrix Concatenate” blocks. Click on the “3 dots” in the corner and select “Create Subsystem”.
  7. Terminate the output from the Subsystem. This will create the required model.
To convert a custom-designed "fftshift" subsystem into HDL for hardware deployment purposes:
  1. Ctrl+E in Simulink to open the “Configurations Parameters” window and select the preferred language:
  2. Select the Subsystem and enter the following line in MATLAB Command Window:
>> makehdl(gcb)
3. This will convert the Simulink model in HDL. The required language file can be found by navigating to hdl_prj > hdlsrc > untitled > fft_shift_custom.v
For further information, refer to the MathWorks documentation links below:

Ajit
Ajit 2024 年 8 月 6 日
Ninja stak
Aakansha Agarwal

Rahul
Rahul 2024 年 8 月 7 日
I believe there is no direct block that you can use to achieve the functionality of 'fftshift' function.
you can consider creating an Embedded MATLAB function block and using the 'fftshift' function inside it to achieve it's functionality in Simulink.
You can refer to the following documentation to know more about the 'fftshift' function: https://www.mathworks.com/help/releases/R2024a/matlab/ref/fftshift.html?searchHighlight=fftshift&s_tid=doc_srchtitle
Hope this helps! Thanks.

カテゴリ

Help Center および File ExchangeTransforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by