function varargout = radar(varargin)
% RADAR MATLAB code for radar.fig
% RADAR, by itself, creates a new RADAR or raises the existing
% singleton*.
%
% H = RADAR returns the handle to a new RADAR or the handle to
% the existing singleton*.
%
% RADAR('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in RADAR.M with the given input arguments.
%
% RADAR('Property','Value',...) creates a new RADAR or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before radar_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to radar_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 radar
% Last Modified by GUIDE v2.5 12-Jun-2018 22:22:48
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @radar_OpeningFcn, ...
'gui_OutputFcn', @radar_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 radar is made visible.
function radar_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 radar (see VARARGIN)
% Choose default command line output for radar
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes radar wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = radar_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
T=get(handles.T0,'String');T=str2num(T);
t=get(handles.tao,'String');t=str2num(t);
f0=20e+6;fs=5*f0;A=1;T=T*100;t=t*100;
m=(-T/2+1):(T/2);
f=rectpuls(m+T/2-t/2,t);
s1=A*cos(2*pi*f0*m/fs);
s2=f.*s1;
z=zeros(1,10000);
for m=0:4
for n=1:2000
z(n+m*2000)=s2(n);
end
end
tz=1:10000;
axes(handles.axes1);
plot(tz/fs,z);grid on;
xlabel('t/s');ylabel('U/v');title('发射信号');
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
T=get(handles.T0,'String');T=str2num(T);
t=get(handles.tao,'String');t=str2num(t);
R=get(handles.R0,'String');R=str2num(R);R=2000*R/3;
f0=20e+6;fs=5*f0;A=1;T=T*100;t=t*100;
m=(-T/2+1):(T/2);
f=rectpuls(m+T/2-R,t);
s1=0.5*A*cos(2*pi*f0*m/fs);
s2=f.*s1;
z=zeros(1,10000);
for m=0:4
for n=1:2000
z(n+m*2000)=s2(n);
end
end
tz=1:10000;
axes(handles.axes1);
plot(tz/fs,z);grid on;
xlabel('t/s');ylabel('U/v');title('回波信号');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
T=get(handles.T0,'String');T=str2num(T);
t=get(handles.tao,'String');t=str2num(t);
R=get(handles.R0,'String');R=str2num(R);R=2000*R/3;
A=1;f0=20e+3;fs=5*f0;T=2000;t=100;
m=(-T/2+1):(T/2);
f=rectpuls(m+T/2-R,t);
s1=0.5*A*cos(2*pi*f0*m/fs);
s2=f.*s1;
z1=zeros(1,10000);
for m=0:4
for n=1:2000
z1(n+m*2000)=s2(n);
end
end
x=wgn(1,10000,-20);
y=x+z1;
m=1:10000;
f1=25e+3;
s3=10*cos(2*pi*f1*m/fs);
s4=s3.*y;
tz=1:10000;
axes(handles.axes1)
plot(tz,abs(fft(s4,10000)));grid on;
xlabel('k');ylabel('混频信号幅值');title('混频信号频谱');
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
T=get(handles.T0,'String');T=str2num(T);
t=get(handles.tao,'String');t=str2num(t);
R=get(handles.R0,'String');R=str2num(R);R=2000*R/3;
f0=20e+6;fs=5*f0;A=1;T=T*100;t=t*100;
m=(-T/2+1):(T/2);
f=rectpuls(m+T/2-R,t);
s1=0.5*A*cos(2*pi*f0*m/fs);
s2=f.*s1;
z=zeros(1,10000);
for m=0:4
for n=1:2000
z(n+m*2000)=s2(n);
end
end
x=wgn(1,10000,-20);
y=x+z;
m=1:10000;
f1=25e+3;
s3=10*cos(2*pi*f1*m/fs);
s4=s3.*y;
S=fft(s4,10472);
Wp=[0.016,0.024];Ws=[0.014,0.026];Rp=1;Rs=35;
[N,Wpo]=cheb1ord(Wp,Ws,Rp,Rs);
[B,A]=cheby1(N,Rp,Wpo);
w=0:0.0003:pi;
[H,w1]=freqz(B,A,w);
Y=S.*H;
tz=1:10472;
axes(handles.axes1);
plot(tz,abs(Y));
xlabel('k');ylabel('滤波信号幅值');title('滤波结果');
function R1_Callback(hObject, eventdata, handles)
% hObject handle to R1 (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 R1 as text
% str2double(get(hObject,'String')) returns contents of R1 as a double
% --- Executes during object creation, after setting all properties.
function R1_CreateFcn(hObject, eventdata, handles)
% hObject handle to R1 (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
function T0_Callback(hObject, eventdata, handles)
% hObject handle to T0 (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 T0 as text
% str2double(get(hObject,'String')) returns contents of T0 as a double
% --- Executes during object creation, after setting all properties.
function T0_CreateFcn(hObject, eventdata, handles)
% hObject handle to T0 (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
function tao_Callback