⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synthesizablematlab_script.m

📁 Lab 2 – Synthesizable MATLAB This lab exercise will explore the effects that different MATLAB codin
💻 M
字号:
%       AccelDSP 8.1.1 build 690 Production, compiled Apr 26 2006 
% 
%    THIS IS UNPUBLISHED, LICENSED SOFTWARE THAT IS THE CONFIDENTIAL 
%        AND PROPRIETARY PROPERTY OF XILINX OR ITS LICENSORS 
% 
%     Copyright(c) Xilinx, Inc., 2000-2006, All Rights Reserved. 
%     Reproduction or reuse, in any form, without the explicit written 
%     consent of Xilinx, Inc., is strictly prohibited. 
 
clc;clear all;

% Create the filter coefficients
NUMSAMPS = 1024*2;
NUMTAPS = 32;
BE = 0.25;
b = fir1(NUMTAPS-1,BE);

% Create the input stimulus
rand('state',0);
scale = 2*sqrt(12); 
X = (rand(1,NUMSAMPS)-0.5)*scale;

% Block-based filter call
% y = filter(b,1,X);

% Streaming filter call
% state = zeros(1,length(b)-1);
% for n = 1:length(x)
%     [y(n),state] = filter(b,1,X(n),state);
% end

%Streaming filter call in a design function
tic
for n = 1:length(X)
    y(n) = behavioral_filter(X(n));
end
toc

% Generate power spectral density of the filter outputs
[Pout,Wout]=aw_psd(y,1024,2);

% Plot the PSD reponse of the filter
plot(Wout,10*log10(Pout),'r');

%save y.txt -ascii -double y;
y_golden = load('y.txt');
figure;plot(y_golden-y);title('Y Max Error')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -