A list,
Prediction based on matlab GUI one-step linear + Weiner filtering
Ii. Source code
function varargout = WeinerFilter(varargin)
% WEINERFILTER M-file for WeinerFilter.fig
% WEINERFILTER, by itself, creates a new WEINERFILTER or raises the existing
% singleton*.
%
% H = WEINERFILTER returns the handle to a new WEINERFILTER or the handle to
% the existing singleton*.
%
% WEINERFILTER('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in WEINERFILTER.M with the given input arguments.
%
% WEINERFILTER('Property'.'Value',...). creates anew WEINERFILTER or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before WeinerFilter_OpeningFcn gets called. An
% unrecognized property name orinvalid value makes property application % stop. All inputs are passed to WeinerFilter_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help WeinerFilter
% Last Modified by GUIDE v2. 5 28-May- 2021. 16:23:34
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @WeinerFilter_OpeningFcn, ...
'gui_OutputFcn', @WeinerFilter_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 WeinerFilter is made visible.
function WeinerFilter_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 WeinerFilter (see VARARGIN)
% Choose default command line output for WeinerFilter
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
set(handles.listSignal,'string'.'1 - | signal | 3-2 - AR process of two sine signal + N | | 4 - single sine signal 5 - SAR_Line');
% UIWAIT makes WeinerFilter wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = WeinerFilter_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 on button press in btnWiener.
function btnWiener_Callback(hObject, eventdata, handles)
% hObject handle to btnWiener (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% Get data pInfo= getappdata(handles.figure1,'mydata');
x=pInfo.pData;
s=pInfo.pDataS;
M=length(x);
N=str2num(get(handles.edLengthFilter,'string'));
fNoiseM=str2num(get(handles.edNoiseM,'string')); % axes(handles. AxesOut); % autocorrelation matrix R Re=zeros(1,M);
for i=1:N
for j=1:M
if j+i- 1<=M
Re(1,i)=x(1,j)*x(1,j+i- 1)'/(M-i+1)+Re(1,i); end end end R=zeros(N,N); For I =1:N for j= I :N if(I ==j) R(I, I)=Re(1,1); else R(i,j)=Re(1,j-i+1); R(j,i)=conj(R(i,j)); End end end % r r=zeros(1,N); for i=1:N for j=1:M if j-i+1>0 r(1,i)=x(1,j)*s(1,j-i+1)'/(M-i+1)+r(1,i);
end
end
end
Wopt=inv(R)*r'; % Optimal tap weight vector X=zeros(1,M); % filter outputfor n1=1:M
if n1<N
for i=0:n1- 1
X(1,n1)=Wopt(i+1.1)*x(1,n1-i)+X(1,n1);
end
else
for i=0:N- 1
X(1,n1)=Wopt(i+1.1)*x(n1-i)+X(1,n1); End end end %% % to delay %for j=1:M
% if(j>=M-iDelay-iDelay)
% XX(1,j)=0;
% else
% XX(1,j)=X(1,j+iDelay+iDelay);
% end
% end
hold off
plot(s,'.-k'.'linewidth'.2);hold on
plot(x,'.-b');
hold on
plot(X,'*-r'.'linewidth'.2);
hold off
legend('Primary signal'.'Noise signal'.'Filtered signal')
%%
% --- Executes on selection change in listSignal.
function listSignal_Callback(hObject, eventdata, handles)
% hObject handle to listSignal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns listSignal contents as cell array
% contents{get(hObject,'Value')} returns selected item from listSignal
% --- Executes during object creation, after setting all properties.
function listSignal_CreateFcn(hObject, eventdata, handles)
% hObject handle to listSignal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0.'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor'.'white');
end
function edLengthSignal_Callback(hObject, eventdata, handles)
% hObject handle to edLengthSignal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edLengthSignal as text
% str2double(get(hObject,'String')) returns contents of edLengthSignal as a double
% --- Executes during object creation, after setting all properties.
function edLengthSignal_CreateFcn(hObject, eventdata, handles)
% hObject handle to edLengthSignal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0.'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor'.'white');
end
Copy the code
3. Operation results
Fourth, note
Version: 2014 a