Вы находитесь на странице: 1из 12

functionvarargout = analysis(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @analysis_OpeningFcn, ...
'gui_OutputFcn', @analysis_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback',
[]);
ifnargin&&ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
ifnargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before analysis is made visible.


functionanalysis_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
globalb_xyb_r
axes(handles.axes2);
holdoff;
cluster(b_xy(1),b_r);
gridon;
xlim([real(b_xy(1))-((3/2)*b_r),real(b_xy(1))+((3/2)*b_r)]);
ylim([imag(b_xy(1))-(sqrt(3)*b_r),imag(b_xy(1))+(sqrt(3)*b_r)]);
text(real(b_xy(1))+0.02,imag(b_xy(1)),
['BS',num2str(1)],'FontSize',16);
% UIWAIT makes analysis wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
functionvarargout = analysis_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;

functionnumber_ms_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

[Type the document title]


functionnumber_ms_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionresource_allocation_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
functionresource_allocation_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionsignal_noise_ratio_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionsignal_noise_ratio_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functiongeometry_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
functiongeometry_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionchip_rate_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
functionchip_rate_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionbit_rate_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

- 97 -

[Type the document title]


functionbit_rate_CreateFcn(hObject, eventdata, handles)
ckgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functioncapacity_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functioncapacity_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in spreading_factor.


functionspreading_factor_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionspreading_factor_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionebno_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionebno_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionmobile_station_Callback(hObject, eventdata, handles)


globalconnected_msms_xyb_xyms_db_r alpha Geo1 dis
ms_num=str2double(get(handles.mobile_station,'String'));
[tf,index]=ismember(ms_num,connected_ms);
ifisnan(ms_num),
errordlg('Please Enter the Mobile Station Number from inside the
Cell','Error');
elseifout_cell(b_xy(1),b_r,ms_xy(index))==-1,
errordlg('Please Enter the Mobile Station Number from inside the
Cell','Error');
elsems_d=sqrt((real(ms_xy(index))-real(b_xy)).^2+(imag(ms_xy(index))imag(b_xy)).^2);
dis = ms_d(1);

- 98 -

[Type the document title]


set(handles.distance,'String',num2str(ms_d(1)));
[ms_d_sort,ix]=sort(ms_d);
ms_d_sort(1)=[];
ix(1)=[];
ms_d_sort=ms_d_sort(1:4);
ix=ix(1:4);
for j=1:max(size(ms_d_sort));
sigma1(j) = ms_d_sort(j)^(-alpha);
end;
Geo1=10*log10((min(ms_d)^(-alpha))/sum(sigma1));
cla;
analysis_OpeningFcn(hObject, eventdata, handles);
x=[real(b_xy(1)) real(ms_xy(index))];
y=[imag(b_xy(1)) imag(ms_xy(index))];
plot(real(ms_xy(index)),imag(ms_xy(index)),'--rs','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',8)
plot(x,y,'color','red','LineWidth',2);
fori=1:4,
x=[real(b_xy(ix(i))) real(ms_xy(index))];
y=[imag(b_xy(ix(i))) imag(ms_xy(index))];
plot(x,y,'color','black','LineWidth',1,'linestyle','-.');
end;
end;
set(handles.geometry,'String',num2str(Geo1));
% Hints: get(hObject,'String') returns contents of mobile_station as
text
%
str2double(get(hObject,'String')) returns contents of
mobile_station as a double

% --- Executes during object creation, after setting all properties.


functionmobile_station_CreateFcn(hObject, eventdata, handles)
% hObject
handle to mobile_station (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.
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functiontransmitter_power_Callback(hObject, eventdata, handles)


_power as a double

% --- Executes during object creation, after setting all properties.


functiontransmitter_power_CreateFcn(hObject, eventdata, handles)

- 99 -

[Type the document title]

ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functiontransmitter_antenna_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functiontransmitter_antenna_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functiontransmitter_losses_Callback(hObject, eventdata, handles)


functiontransmitter_losses_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functiondistance_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
functiondistance_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionpath_loss_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionpath_loss_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionloss_reflection_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.

- 100 -

[Type the document title]


functionloss_reflection_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in fading_margin.


functionfading_margin_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionfading_margin_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in margin_shadowing.


functionmargin_shadowing_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionmargin_shadowing_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionown_cell_Callback(hObject, eventdata, handles)


globall_im
own_cell_inter=str2double(get(handles.own_cell,'String'));
l_im=1.65*own_cell_inter;
set(handles.interference_margin,'String',num2str(l_im));

% --- Executes during object creation, after setting all properties.


functionown_cell_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionreceiver_antenna_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

- 101 -

[Type the document title]


functionreceiver_antenna_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionreceived_power_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionreceived_power_CreateFcn(hObject, eventdata, handles)
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionreceiver_losses_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
functionreceiver_losses_CreateFcn(hObject, eventdata, handles)
% hObject
handle to receiver_losses (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.
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functioninterference_margin_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functioninterference_margin_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in link.


functionlink_Callback(hObject, eventdata, handles)
% hObject
handle to link (see GCBO)

- 102 -

[Type the document title]


% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalp_txg_txl_txl_pll_el_fml_sdl_img_rxl_rx
if (get(handles.radiobutton_wall,'Value') ==
get(handles.radiobutton_wall,'Max')),
index_selected = get(handles.loss_reflection,'Value');
list = get(handles.loss_reflection,'String');
l_e = list{index_selected};
elsel_e=10;
end;
index_selected = get(handles.fading_margin,'Value');
list = get(handles.fading_margin,'String');
l_fm = list{index_selected};
index_selected = get(handles.margin_shadowing,'Value');
list = get(handles.margin_shadowing,'String');
l_sd = list{index_selected};
if get(handles.checkbox_hata,'Value')==1
p_rx = p_tx + g_tx + l_tx - l_pl + g_rx - l_rx;
else
p_rx=p_tx+g_tx-l_tx-l_pl-l_e-l_fm-l_sd-l_im+g_rx-l_rx;
end;
set(handles.received_power,'String',num2str(p_rx));

functionload_factor_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


functionload_factor_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in start.


functionstart_Callback(hObject, eventdata, handles)
% hObject
handle to start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalb_xyb_rconnected_msms_xy k
num_ms=str2double(get(handles.number_ms,'String'));
k=1;j=1;l=1;
while k <= num_ms,
ms_x(k)=real(b_xy(1))+((3/2)*b_r*rand_integer*rand);
ms_y(k)=imag(b_xy(1))+((sqrt(3)*b_r*rand_integer*rand));
ms_xy(k)=complex(ms_x(k),ms_y(k));
plot(real(ms_xy(k)),imag(ms_xy(k)),'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',6);
text(real(ms_xy(k))+0.1,imag(ms_xy(k)),num2str(k),'FontSize',12,'colo
r','k');
ifout_cell(b_xy(1),b_r,ms_xy(k))~=-1,
connected_ms(j)=k;
x=[real(b_xy(1)) real(ms_xy(k))];
y=[imag(b_xy(1)) imag(ms_xy(k))];
plot(x,y,'color','red','LineWidth',2);
elseinterference_ms(l)=k;
x=[real(b_xy(1)) real(ms_xy(k))];

- 103 -

[Type the document title]


y=[imag(b_xy(1)) imag(ms_xy(k))];
plot(x,y,'color','black','LineWidth',1);
end;
k=k+1;
l=l+1;
j=j+1;
end;
% --- Executes on button press in cell_capacity.
functioncell_capacity_Callback(hObject, eventdata, handles)
% hObject
handle to cell_capacity (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalsf Geo1 alpha connected_ms load
index_selected = get(handles.spreading_factor,'Value');
list = get(handles.spreading_factor,'String');
sf = list{index_selected};

snir=str2num(get(handles.signal_noise_ratio,'String'));
if ~isnan(snir),
snir_power=10*exp(snir/10);
res_factor=((snir_power)/sf(1))*(alpha+(1/Geo1));
set(handles.resource_allocation,'String',num2str(res_factor));
elseres_factor=str2num(get(handles.resource_allocation,'String'));
snir_power=(sf(1)*res_factor)/((1/Geo1)+alpha);
snir=(10*log(snir_power))/10;
set(handles.signal_noise_ratio,'String',num2str(snir));
end;
i=0.55;
v=0.6;
%e=str2num(get(handles.ebno,'String'))
e=1.5;
chip=str2num(get(handles.chip_rate,'String'));
bit=str2num(get(handles.bit_rate,'String'));
cap=(sf/snir)*(1/((1/Geo1)*alpha));
set(handles.capacity,'String',num2str(round(cap(1))));
load=(e/(chip/bit))*v*(i+1)*nnz(connected_ms);
% --- Executes on button press in factor.
functionfactor_Callback(hObject, eventdata, handles)
% hObject
handle to factor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
global load
set(handles.load_factor,'String',num2str(load));

% --- Executes on button press in radiobutton_macro.


functionradiobutton_macro_Callback(hObject, eventdata, handles)
% hObject
handle to radiobutton_macro (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalp_txg_txl_txg_rxl_rx
p_tx=43;
set(handles.transmitter_power,'String',num2str(p_tx));
g_tx=18;
set(handles.transmitter_antenna,'String',num2str(g_tx));
l_tx=3;

- 104 -

[Type the document title]


set(handles.transmitter_losses,'String',num2str(l_tx));
g_rx=18;
set(handles.receiver_antenna,'String',num2str(g_rx));
l_rx=2;
set(handles.receiver_losses,'String',num2str(l_rx));
% Hint: get(hObject,'Value') returns toggle state of
radiobutton_macro

% --- Executes on button press in radiobutton_micro.


functionradiobutton_micro_Callback(hObject, eventdata, handles)
% hObject
handle to radiobutton_micro (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalp_txg_txl_txg_rxl_rx
p_tx=36;
set(handles.transmitter_power,'String',num2str(p_tx));
g_tx=3;
set(handles.transmitter_antenna,'String',num2str(g_tx));
l_tx=1;
set(handles.transmitter_losses,'String',num2str(l_tx));
g_rx=18;
set(handles.receiver_antenna,'String',num2str(g_rx));
l_rx=2;
set(handles.receiver_losses,'String',num2str(l_rx));
% Hint: get(hObject,'Value') returns toggle state of
radiobutton_micro

% --- Executes on button press in radiobutton_handheld.


functionradiobutton_handheld_Callback(hObject, eventdata, handles)
% hObject
handle to radiobutton_handheld (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalp_txg_txl_txg_rxl_rx
p_tx=21;
set(handles.transmitter_power,'String',num2str(p_tx));
g_tx=0;
set(handles.transmitter_antenna,'String',num2str(g_tx));
l_tx=3;
set(handles.transmitter_losses,'String',num2str(l_tx));
g_rx=0;
set(handles.receiver_antenna,'String',num2str(g_rx));
l_rx=0;
set(handles.receiver_losses,'String',num2str(l_rx));
% Hint: get(hObject,'Value') returns toggle state of
radiobutton_handheld

% --- Executes on button press in radiobutton_data.


functionradiobutton_data_Callback(hObject, eventdata, handles)
globalp_txg_txl_txg_rxl_rx
p_tx=24;
set(handles.transmitter_power,'String',num2str(p_tx));
g_tx=2;
set(handles.transmitter_antenna,'String',num2str(g_tx));
l_tx=0;
set(handles.transmitter_losses,'String',num2str(l_tx));
g_rx=2;
set(handles.receiver_antenna,'String',num2str(g_rx));

- 105 -

[Type the document title]


l_rx=0;
set(handles.receiver_losses,'String',num2str(l_rx));
% Hint: get(hObject,'Value') returns toggle state of radiobutton_data

% --- Executes on button press in radiobutton_out_to_in.


functionradiobutton_out_to_in_Callback(hObject, eventdata, handles)
globall_e
set(handles.loss_reflection,'Style','edit');
l_e=10;
set(handles.loss_reflection,'String',num2str(l_e));

% --- Executes on button press in radiobutton_wall.


functionradiobutton_wall_Callback(hObject, eventdata, handles)
set(handles.loss_reflection,'Style','listbox');
set(handles.loss_reflection,'String',{'8','10','12','14','16'});
% Hint: get(hObject,'Value') returns toggle state of radiobutton_wall

% --- Executes on button press in radiobutton_urban.


functionradiobutton_urban_Callback(hObject, eventdata, handles)
globall_pldishb
ah = 2.92*(str2double(get(handles.h_ms,'String'))) - 4.33;
l_pl = 157.83 - 13.82*log10(hb)-ah+(44.9-6.55*log10(hb))*log10(dis);
set(handles.path_loss,'String',num2str(l_pl));

% --- Executes on button press in radiobutton_sub.


functionradiobutton_sub_Callback(hObject, eventdata, handles)
globall_pldishbhm
ah = 2.92*hm - 4.33;
l_pl = (157.83 - 13.82*log10(hb)-ah+(44.96.55*log10(hb))*log10(dis))-1.4;
set(handles.path_loss,'String',num2str(l_pl));
% Hint: get(hObject,'Value') returns toggle state of radiobutton_sub

% --- Executes on button press in radiobutton_dense.


functionradiobutton_dense_Callback(hObject, eventdata, handles)
globall_pldishbhm
ah = 3.2*(log10(11.75*hm))^2 - 4.97;
l_pl = 157.83 - 13.82*log10(hb)-ah+(44.9-6.55*log10(hb))*log10(dis);
set(handles.path_loss,'String',num2str(l_pl));

functionh_ms_Callback(hObject, eventdata, handles)

- 106 -

[Type the document title]

% --- Executes during object creation, after setting all properties.


functionh_ms_CreateFcn(hObject, eventdata, handles)
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

functionh_bts_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
functionh_bts_CreateFcn(hObject, eventdata, handles)
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in checkbox_hata.


functioncheckbox_hata_Callback(hObject, eventdata, handles)
% hObject
handle to checkbox_hata (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalhbhm
hb = str2double(get(handles.h_bts,'String'));
hm = str2double(get(handles.h_ms,'String'));
set(handles.checkbox_free,'Value',0);
set(handles.radiobutton_out_to_in,'Value',0);
set(handles.radiobutton_wall,'Value',0);
% Hint: get(hObject,'Value') returns toggle state of checkbox_hata

% --- Executes on button press in checkbox_free.


functioncheckbox_free_Callback(hObject, eventdata, handles)
% hObject
handle to checkbox_free (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
globalhmhbl_pldis
set(handles.checkbox_hata,'Value',0);
set(handles.radiobutton_urban,'Value',0);
set(handles.radiobutton_sub,'Value',0);
set(handles.radiobutton_dense,'Value',0);
l_pl = 20*log10(hb*hm/dis^2);
set(handles.path_loss,'String',num2str(l_pl));
% Hint: get(hObject,'Value') returns toggle state of checkbox_free

- 107 -

Вам также может понравиться