📄 mri_verify.m
字号:
% % $Id: mri_verify.m,v 1.1.2.3 2008/06/12 16:12:55 igork Exp $% % DISCLAIMER OF LIABILITY% % This text/file contains proprietary, confidential% information of Xilinx, Inc., is distributed under license% from Xilinx, Inc., and may be used, copied and/or% disclosed only pursuant to the terms of a valid license% agreement with Xilinx, Inc. Xilinx hereby grants you a % license to use this text/file solely for design, simulation, % implementation and creation of design files limited % to Xilinx devices or technologies. Use with non-Xilinx % devices or technologies is expressly prohibited and % immediately terminates your license unless covered by% a separate agreement.% % Xilinx is providing this design, code, or information % "as-is" solely for use in developing programs and % solutions for Xilinx devices, with no obligation on the % part of Xilinx to provide support. By providing this design, % code, or information as one possible implementation of % this feature, application or standard, Xilinx is making no % representation that this implementation is free from any % claims of infringement. You are responsible for % obtaining any rights you may require for your implementation. % Xilinx expressly disclaims any warranty whatsoever with % respect to the adequacy of the implementation, including % but not limited to any warranties or representations that this% implementation is free from claims of infringement, implied % warranties of merchantability or fitness for a particular % purpose.% % Xilinx products are not intended for use in life support% appliances, devices, or systems. Use in such applications is% expressly prohibited.% % Any modifications that are made to the Source Code are % done at the user抯 sole risk and will be unsupported.% % % Copyright (c) 2008 Xilinx, Inc. All rights reserved.% % This copyright and support notice must be retained as part % of this text at all times. %% Run simulation of generated model mri.mdl firstopen_system('mri')sim('mri')%% Verification scripttest_model=0;if (max(mri_model_channel)==min(mri_model_channel)) % one channel only for ii=1:length(mri_model_output)/m_ddc test_model=[test_model, mri_model_output((ii-1)*m_ddc+1)]; endelse for ii=1:length(mri_model_output) if (mri_model_channel(ii)==0) if(ii==1) % measure only channel 1 (which corresponds to 0 in % the TDM output test_model=[test_model, mri_model_output(ii)]; else if(mri_model_channel(ii-1)~=0) test_model=[test_model, mri_model_output(ii)]; end end end endend%% Calculate the resulting spectrum% cutting out the middle of the result helps to get the spectrum right, with no% side effects of the initial filter responsefft_result_full=fft(test_model(length(test_model)/4+1:length(test_model)/4+length(sample)/2/m_cic));fft_result=fft_result_full;norm_hw=sum(abs(fft_result))/length(fft_result);%% Compare with the model sampleload mri_model_output.matfft_model_full=fft(yc_quant(length(yc_quant)/4:length(yc_quant)/4+length(sample)/2/m_cic-1));fft_model=fft_model_full;norm_sw=sum(abs(fft_model))/length(fft_model);xfreq=[1:length(fft_model)];figure; plot(xfreq, abs(fft_model)/norm_sw, xfreq, abs(fft_result)/norm_hw); title('SW Result,Channel 1 (Absolute)');figure; plot(xfreq, 20*log10(abs(fft_model)/max(abs(fft_model))), xfreq, 20*log10(abs(fft_result)/max(abs(fft_result))) ); title('SW Result,Channel 1 (dB)');% Display the difference between the model and sysgen implementationfigure;plot(abs(fft_result)/norm_hw-abs(fft_model)/norm_sw);title('HW/SW result difference,Channel 1 (Absolute)');figure;plot(xfreq, 20*log10(abs(abs(fft_result)/norm_hw-abs(fft_model)/norm_sw)/max(abs(fft_result)/norm_hw)));title('HW/SW result difference,Channel 1 (dB)');noise = max(abs(fft_result)/norm_hw-abs(fft_model)/norm_sw)/max(abs(fft_model)/norm_sw);sprintf('Noise = %f%% or %f dB',noise*100, 20*log10(noise))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -