Using Matlab to generate the signal to be filtered

Source: Internet
Author: User
Tags vivado
using Matlab to generate the signal to be filtered

1, open the MATLAB software, in the command window input fdatool and enter, you will pop up the filter design tool.

2. Click "Close" in the pop-up prompt window.

3, according to the requirements of this experiment, select low-pass lowpass in the response type Response type; Design method The Fir is selected and the design of the FIR digital filter is chosen by Window function Method window. Select Specify order in the filter order, enter 7 here, and note that the value entered here is the order of the filter to be designed minus 1. Tick the scale passhand in the options and select the Window as Hamming. In Frequency specifications The unit selects HZ, the sampling frequency Fs input value is 100, and the cutoff frequency Fc input value is 10. The desired filter can be designed by clicking on the design filter.

4, in the Fdatool tool interface, click File to select Export, click Export in the Pop-up window, you can generate the filter's tap coefficient in MATLAB.

5, the results can be seen in the Workspace of MATLAB.

6, the specific calculated coefficients are as follows:

H (0) = 0.00875474290329771
H (1) = 0.0479488721685246
H (2) = 0.164024391089411
H (3) = 0.279271993838767
H (4) = 0.279271993838767
H (5) = 0.164024391089411
H (6) = 0.0479488721685246
H (7) = 0.00875474290329771

Because the FPGA does not support the operation of floating-point numbers, the tap coefficients need to be quantified. In the Fdatool interface, first click on the button, in the Filter arithmetic to select fixed-point, number word length can be entered in length, when input 8 o'clock, click Apply, you can see a larger deviation. So change the value to 16.

7. Second, click Target and select XILINX coefficient in the drop-down menu. COE) file can be generated.
A quantified filter factor saved as a. COE file that can be in Vivado when the order of the filter is high
By reading the IP core of the ROM, the filter order of this experiment is relatively small, so the result can be copied directly to the filter
In the Verilog program.

8. The MATLAB main interface can view the content of the generated Coe file.

9. Right-click on the current Folder window in the main interface of MATLAB and select New file->script

10. Rename the newly generated suffix ". M" File to "SIGNAL.M" and double-click to open, write the program,
The waveform to be filtered is generated in MATLAB and is then output in the form of a ". Coe" file after sample quantization.

11, click Run in the toolbar, running the program, you can see the pop-up waveform window.

12. In the curent Folder window, you can see that a file named "Sample.coe" is generated, double-click to open to view
its contents. The file data is called from the IP core of the ROM in Vivado, and the waveform data is stored in the ROM.

13, in the Fdatool tool interface, select File, Generate MATLAB Code, Filter Design
Functions.

14. In the pop-up window, change the file name to MYLOWERFILTER.M, click Save

15. The generated mylowerfilter.m file can be seen in the current Folder window of the MATLAB main interface.
Right-click in the blank of the current Folder window, select New File->script, and the newly generated suffix named ". M"
Rename the file to "RESULT.M", double-click to open and write the program. The previously generated waveform is passed through the Designed filter,
And the output data is plotted as a waveform

16, click on the tool bar run, running the program, you can see the waveform before and after filtering, by comparing the input and output waveform,
Observe the filtering effect.

Implementation of filter results by FPGA

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.