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

📄 mdsp.m

📁 自编:张贤达《数字信号处理》习题4.26的MATLAB程序。加入了一个GUI界面。 在MATLAB下运行MDSP。 要求MATLAB7以上版本
💻 M
字号:
function varargout = mdsp(varargin)
% MDSP M-file for mdsp.fig
%      MDSP, by itself, creates a new MDSP or raises the existing
%      singleton*.
%
%      H = MDSP returns the handle to a new MDSP or the handle to
%      the existing singleton*.
%
%      MDSP('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MDSP.M with the given input arguments.
%
%      MDSP('Property','Value',...) creates a new MDSP or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before mdsp_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to mdsp_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run1 (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help mdsp

% Last Modified by GUIDE v2.5 01-Jan-2006 14:24:25

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @mdsp_OpeningFcn, ...
                   'gui_OutputFcn',  @mdsp_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before mdsp is made visible.
function mdsp_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to mdsp (see VARARGIN)

% Choose default command line output for mdsp
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes mdsp wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = mdsp_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
[x,map]=imread('mdsp.bmp');
image(x);
colormap(map);
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes1


% --- Executes on button press in run1.
function run1_Callback(hObject, eventdata, handles)
set(handles.run1,'String',' 再运算一次 ');
u=0.006;
N=4000;
A=[1 0.9966 0.9988 0.9982 0.9985;0.9966 1 0.9963 0.9995 0.9889;0.9988 0.9963 1 0.9972 0.9968;0.9982 0.9995 0.9972 1 0.9996;0.9985 0.9989 0.9968 0.9996 1];
n=1:1:N;
v=2*rand(1,N)-1;
s=[sign(cos(2*pi*155*n));sin(2*pi*800*n);sin(2*pi*300*n+6*cos(2*pi*60*n));sin(2*pi*90*n);v];
[y,err]=BlindSignLMS(s,A,u);
plot(n,err);
xlabel(' 样本个数 ');
ylabel(' 串音误差 ');
% hObject    handle to run1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% --- Executes on button press in problem1.
function problem1_Callback(hObject, eventdata, handles)
set(handles.run1,'String',' 运算一次 ');
[x,map]=imread('mdsp.bmp');
image(x);
%colormap(map);
% hObject    handle to problem1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% --- Executes on button press in exit.
function exit_Callback(hObject, eventdata, handles)
close;
% hObject    handle to exit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% --- Executes on button press in run2.
function run2_Callback(hObject, eventdata, handles)
%cla;
%hold on;
u=0.006;
Num=4000;
A=[1 0.9966 0.9988 0.9982 0.9985;0.9966 1 0.9963 0.9995 0.9889;0.9988 0.9963 1 0.9972 0.9968;0.9982 0.9995 0.9972 1 0.9996;0.9985 0.9989 0.9968 0.9996 1];
n=1:1:Num;
errall=zeros(1,Num);
for j=1:1:200
    v=2*rand(1,Num)-1;
    s=[sign(cos(2*pi*155*n));sin(2*pi*800*n);sin(2*pi*300*n+6*cos(2*pi*60*n));sin(2*pi*90*n);v];
    [y,err]=BlindSignLMS(s,A,u);
    errall=errall+err;
end
plot(n,errall/200);
%axis xy;
%axis auto;
xlabel(' 样本个数 ');
ylabel(' 串音误差 ');
%hold off;
% hObject    handle to run2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


⌨️ 快捷键说明

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