function varargout = cfar(varargin)
%CFAR MATLAB code file for cfar.fig
% CFAR, by itself, creates a new CFAR or raises the existing
% singleton*.
%
% H = CFAR returns the handle to a new CFAR or the handle to
% the existing singleton*.
%
% CFAR('Property','Value',...) creates a new CFAR using the
% given property value pairs. Unrecognized properties are passed via
% varargin to cfar_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% CFAR('CALLBACK') and CFAR('CALLBACK',hObject,...) call the
% local function named CALLBACK in CFAR.M with the given input
% arguments.
%
% *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 cfar
% Last Modified by GUIDE v2.5 12-May-2020 18:48:44
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @cfar_OpeningFcn, ...
'gui_OutputFcn', @cfar_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 cfar is made visible.
function cfar_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 unrecognized PropertyName/PropertyValue pairs from the
% command line (see VARARGIN)
% Choose default command line output for cfar
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes cfar wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = cfar_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)
global noise_p;
global xc;
axes(handles.axes5);
if get(handles.radiobutton4,'value')
shape1=get(handles.edit9,'string');
shape1=str2double(shape1);
shape2=get(handles.edit10,'string');
shape2=str2double(shape2);
db1=get(handles.edit1,'string');
db1=str2double(db1);
db2=get(handles.edit8,'string');
db2=str2double(db2);
shape=[shape1,shape2];
variance=get(handles.edit2,'string');
variance=str2double(variance);
noise_db=[db1,db2];
noise_p=10.^(noise_db./10);
show_out=1;
[ xc ] = env_edge(variance, shape, noise_db,show_out);
end
if get(handles.radiobutton3,'value')
shape1=get(handles.edit10,'string');
shape1=str2double(shape1);
variance=get(handles.edit2,'string');
variance=str2double(variance);
db1=get(handles.edit1,'string');
db1=str2double(db1);
noise_p=10.^(db1./10);
show_out=1;
[ xc ] = env_uniform(variance, shape1, db1,show_out);
end
% --- 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)
global noise_p;
global xc;
if get(handles.radiobutton3,'value')&&get(handles.radiobutton1,'value')
SNR1=get(handles.edit4,'string');
SNR1=str2double(SNR1);
signal1_p=10.^(SNR1./10).*noise_p;
des1=get(handles.edit15,'string');
des1=str2double(des1);
xc(1,des1)=signal1_p;
N=get(handles.edit13,'string');
N=str2double(N);
pro_N=get(handles.edit7,'string');
pro_N=str2double(pro_N);
PAD=get(handles.edit14,'string');
PAD=str2double(PAD);
k=2.*N./4;
if get(handles.radiobutton5,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_ac( xc, N, pro_N, PAD);
end
if get(handles.radiobutton6,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_go( xc, N, pro_N, PAD);
end
if get(handles.radiobutton7,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_os( abs(xc), N, k, pro_N, PAD);
end
if get(handles.radiobutton8,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_so( xc, N, pro_N, PAD);
end
end
if get(handles.radiobutton4,'value')&&get(handles.radiobutton1,'value')
SNR1=get(handles.edit4,'string');
SNR1=str2double(SNR1);
signal1_p=10.^(SNR1./10).*noise_p(1,end);
des1=get(handles.edit15,'string');
des1=str2double(des1);
xc(1,des1)=signal1_p;
N=get(handles.edit13,'string');
N=str2double(N);
pro_N=get(handles.edit7,'string');
pro_N=str2double(pro_N);
PAD=get(handles.edit14,'string');
PAD=str2double(PAD);
k=2.*N./4;
if get(handles.radiobutton5,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_ac( xc, N, pro_N, PAD);
end
if get(handles.radiobutton6,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_go( xc, N, pro_N, PAD);
end
if get(handles.radiobutton7,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_os( abs(xc), N, k, pro_N, PAD);
end
if get(handles.radiobutton8,'value')&&get(handles.radiobutton1,'value')
[ index, XT ] = cfar_so( xc, N, pro_N, PAD);
end
end
if get(handles.radiobutton3,'value')&&get(handles.radiobutton2,'value')
SNR1=get(handles.edit4,'string');
SNR1=str2double(SNR1);
SNR2=get(handles.edit5,'string');
SNR2=str2double(SNR2);
SNR3=get(handles.edit11,'string');
SNR3=str2double(SNR3);
SNR4=get(handles.edit12,'string');
SNR4=str2double(SNR4);
signal1_p=10.^(SNR1./10).*noise_p;
signal2_p=10.^(SNR2./10).*noise_p;
signal3_p=10.^(SNR3./10).*noise_p;
signal4_p=10.^(SNR4./10).*noise_p;
des1=get(handles.edit15,'string');
des1=str2double(des1);
des2=get(handles.edit16,'string');
des2=str2double(des2);
des3=get(handles.edit17,'string');
des3=str2double(des3);
des4=get(handles.edit18,'string');
des4=str2double(des4);
xc(1,des1)=signal1_p;
xc(1,des2)=signal2_p;
xc(1,des3)=signal3_p;
xc(1,des4)=signal4_p;
N=get(handles.edit13,'string');
N=str2double(N);
pro_N=get(handles.edit7,'string');
pro_N=str2double(pro_N);
PAD=get(handles.edit14,'string');
PAD=str2double(PAD);
k=2.*N./4;
if get(handles.radiobutton5,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_ac( xc, N, pro_N, PAD);
end
if get(handles.radiobutton6,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_go( xc, N, pro_N, PAD);
end
if get(handles.radiobutton7,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_os( abs(xc), N, k, pro_N, PAD);
end
if get(handles.radiobutton8,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_so( xc, N, pro_N, PAD);
end
end
if get(handles.radiobutton4,'value')&&get(handles.radiobutton2,'value')
SNR1=get(handles.edit4,'string');
SNR1=str2double(SNR1);
SNR2=get(handles.edit5,'string');
SNR2=str2double(SNR2);
SNR3=get(handles.edit11,'string');
SNR3=str2double(SNR3);
SNR4=get(handles.edit12,'string');
SNR4=str2double(SNR4);
SNR5=get(handles.edit19,'string');
SNR5=str2double(SNR5);
SNR6=get(handles.edit20,'string');
SNR6=str2double(SNR6);
signal1_p=10.^(SNR1./10).*noise_p(1,end);
signal2_p=10.^(SNR2./10).*noise_p(1,end);
signal3_p=10.^(SNR3./10).*noise_p(1,end);
signal4_p=10.^(SNR4./10).*noise_p(1,end);
signal5_p=10.^(SNR4./10).*noise_p(1,end);
signal6_p=10.^(SNR4./10).*noise_p(1,end);
des1=get(handles.edit15,'string');
des1=str2double(des1);
des2=get(handles.edit16,'string');
des2=str2double(des2);
des3=get(handles.edit17,'string');
des3=str2double(des3);
des4=get(handles.edit18,'string');
des4=str2double(des4);
des5=get(handles.edit21,'string');
des5=str2double(des5);
des6=get(handles.edit22,'string');
des6=str2double(des6);
xc(1,des1)=signal1_p;
xc(1,des2)=signal2_p;
xc(1,des3)=signal3_p;
xc(1,des4)=signal4_p;
xc(1,des5)=signal5_p;
xc(1,des6)=signal6_p;
N=get(handles.edit13,'string');
N=str2double(N);
pro_N=get(handles.edit7,'string');
pro_N=str2double(pro_N);
PAD=get(handles.edit14,'string');
PAD=str2double(PAD);
k=2.*N./4;
if get(handles.radiobutton5,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_ac( xc, N, pro_N, PAD);
end
if get(handles.radiobutton6,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_go( xc, N, pro_N, PAD);
end
if get(handles.radiobutton7,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_os( abs(xc), N, k, pro_N, PAD);
end
if get(handles.radiobutton8,'value')&&get(handles.radiobutton2,'value')
[ index, XT ] = cfar_so( xc, N, pro_N, PAD);
end
end
axes(handles.axes2);
cla reset
if get(handles.radiobutton1,'value')
plot(10.*log(abs(xc))./log(10)),hold on;
plot(des1,10.*log(abs(xc(1,des1)))./log(10),'r*', 'LineWidth',10),hold on;
plot(index,10.*log(abs(XT))./log(10),'g');
legend('回波','目标','检测门限')
end
if get(handles.radiobutton2,'value')&&get(handles.radiobutton3,'value')
plot(10.*log(abs(xc))./log(10)),hold on;
plot(des1,10.*log(abs(xc(1,des1)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des2,10.*log(abs(xc(1,des2)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des3,10.*log(abs(xc(1,des3)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des4,10.*log(abs(xc(1,des4)))./log(10),'r*', 'LineWidth',10),hold on;
plot(index,10.*log(abs(XT))./log(10),'g');
legend('回波','目标','目标','目标','目标','检测门限')
end
if get(handles.radiobutton2,'value')&&get(handles.radiobutton4,'value')
plot(10.*log(abs(xc))./log(10)),hold on;
plot(des1,10.*log(abs(xc(1,des1)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des2,10.*log(abs(xc(1,des2)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des3,10.*log(abs(xc(1,des3)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des4,10.*log(abs(xc(1,des4)))./log(10),'r*', 'LineWidth',10),hold on;
plot(des5,10.*log(abs(xc(1,des5)))./log(10),'y*', 'LineWidth',10),hold on;
plot(des6,10.*log(abs(xc(1,des6)))./log(10),'b*', 'LineWidth',10),hold on;
plot(index,10.*log(abs(XT))./log(10),'g');
legend('回波','目标','目标','目标','目标','杂波边缘目标','杂波内目标','检测门限')
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- 221.
- 222.
- 223.
- 224.
- 225.
- 226.
- 227.
- 228.
- 229.
- 230.
- 231.
- 232.
- 233.
- 234.
- 235.
- 236.
- 237.
- 238.
- 239.
- 240.
- 241.
- 242.
- 243.
- 244.
- 245.
- 246.
- 247.
- 248.
- 249.
- 250.
- 251.
- 252.
- 253.
- 254.
- 255.
- 256.
- 257.
- 258.
- 259.
- 260.
- 261.
- 262.
- 263.
- 264.
- 265.
- 266.
- 267.
- 268.
- 269.
- 270.
- 271.
- 272.
- 273.
- 274.
- 275.
- 276.
- 277.
- 278.
- 279.
- 280.
- 281.
- 282.
- 283.
- 284.
- 285.
- 286.
- 287.
- 288.
- 289.
- 290.
- 291.
- 292.
- 293.
- 294.
- 295.
- 296.
- 297.
- 298.
- 299.
- 300.
- 301.
- 302.
- 303.
- 304.
- 305.
- 306.
- 307.
- 308.
- 309.
- 310.
- 311.
- 312.