0% found this document useful (0 votes)
34 views

Function Varargout

matlab detail web

Uploaded by

hkajai
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Function Varargout

matlab detail web

Uploaded by

hkajai
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

function varargout = thinlinear_antenna(varargin) % THINLINEAR_ANTENNA M-file for thinlinear_antenna.fig gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @thinlinear_antenna_OpeningFcn, ... 'gui_OutputFcn', @thinlinear_antenna_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 % --- Executes just before thinlinear_antenna is made visible. function thinlinear_antenna_OpeningFcn(hObject, eventdata, handles, varargin) % Choose default command line output for thinlinear_antenna handles.output = hObject; handles.L=0.1; a=[-0.05:(0.5/19999):0]; b=[0:(0.5/19999):0.05]; handles.Ic=[0.01.*a+5 -0.01.*b+5]; handles.wt_kr=0:2*pi/3999:2*pi; % Update handles structure guidata(hObject, handles); % --- Outputs from this function are returned to the command line. function varargout = thinlinear_antenna_OutputFcn(hObject, eventdata, handles) % Get default command line output from handles structure varargout{1} = handles.output; % function for lamda/2 function push1_Callback(hObject, eventdata, handles) handles.lamda=0.2; handles.beta=2*pi/handles.lamda; handles.cons=handles.beta*handles.L/2; for theta=0:0.1:(2*pi) E_theta=i*(handles.Ic).*((cos((handles.cons).*cos(theta)))cos(handles.cons)).*(exp(-i*(handles.wt_kr)))./sin(theta); x=real(E_theta); y=imag(E_theta); z=ones(1,size(x,2)).*sin(theta).*cos(theta); grid on plot3(x,y,z,'r'); hold on end hold off set(handles.outtext,'String','lamda/2'); guidata(hObject, handles); % function for 3*lamda/4 function push2_Callback(hObject, eventdata, handles) handles.lamda=(2/15);

handles.beta=2*pi/handles.lamda; handles.cons=handles.beta*handles.L/2; for theta=0:0.1:(2*pi) E_theta=i*(handles.Ic).*((cos((handles.cons).*cos(theta)))cos(handles.cons)).*(exp(-i*(handles.wt_kr)))./sin(theta); x=real(E_theta); y=imag(E_theta); z=ones(1,size(x,2)).*sin(theta).*cos(theta); grid on plot3(x,y,z,'g'); hold on end hold off set(handles.outtext,'String','3*lamda/4'); guidata(hObject, handles); % function for lamda function push3_Callback(hObject, eventdata, handles) handles.lamda=0.1; handles.beta=2*pi/handles.lamda; handles.cons=handles.beta*handles.L/2; for theta=0:0.1:(2*pi) E_theta=i*(handles.Ic).*((cos((handles.cons).*cos(theta)))cos(handles.cons)).*(exp(-i*(handles.wt_kr)))./sin(theta); x=real(E_theta); y=imag(E_theta); z=ones(1,size(x,2)).*sin(theta).*cos(theta); grid on plot3(x,y,z,'b'); hold on end hold off set(handles.outtext,'String','lamda'); guidata(hObject, handles); % function for 3*lamda/2 function push4_Callback(hObject, eventdata, handles) handles.lamda=(1/15); handles.beta=2*pi/handles.lamda; handles.cons=handles.beta*handles.L/2; for theta=0:0.1:(2*pi) E_theta=i*(handles.Ic).*((cos((handles.cons).*cos(theta)))cos(handles.cons)).*(exp(-i*(handles.wt_kr)))./sin(theta); x=real(E_theta); y=imag(E_theta); z=ones(1,size(x,2)).*sin(theta).*cos(theta); grid on plot3(x,y,z,'m'); hold on end hold off set(handles.outtext,'String','3*lamda/2'); guidata(hObject, handles); % function for 2*lamda function push5_Callback(hObject, eventdata, handles) handles.lamda=0.05; handles.beta=2*pi/handles.lamda; handles.cons=handles.beta*handles.L/2; for theta=0:0.1:(2*pi)

E_theta=i*(handles.Ic).*((cos((handles.cons).*cos(theta)))cos(handles.cons)).*(exp(-i*(handles.wt_kr)))./sin(theta); x=real(E_theta); y=imag(E_theta); z=ones(1,size(x,2)).*sin(theta).*cos(theta); grid on plot3(x,y,z,'b'); hold on end hold off set(handles.outtext,'String','2*lamda'); guidata(hObject, handles); %axes callback function axes1_CreateFcn(hObject, eventdata, handles) %outtex model function figure1_CreateFcn(hObject, eventdata, handles) function outtext_CreateFcn(hObject, eventdata, handles)

MATLAB: Radiation pattern of Thin Linear Antenna


Radiation pattern refers to the plot of radiation properties of any antenna. Thin linear antennas are similar to dipole antennas with symmetric fed source at the center by a balanced two wire transmission line. Moreover linear antennas have sinusoidal current distribution. We consider the diameter of the antenna d</100, which provides good natural approximation to the current distribution. Current distributions for various antennas are as shown in figure below.

Fig. Current distribution (source: JD kraus, Antenna and propagation, Thanks Gaurav for this photo) I have plotted the radiation patterns of these antennas with the help of Matlab GUI. The pattern is of electric field is in theta direction. The equation is

This GUI is as shown in the figure below.

Fig. /2 antenna The GUI has facility to choose the antenna size (i.e. length of the antenna, L) = /2, 3/4, , 3/2 and 2. It plots 3D pattern of chosen antenna as shown in figure above; which is field pattern of /2 antenna. The plots of patterns for other antennas are as follows:

Fig. 3/4 antenna

Fig. antenna

Fig. 3/2 antenna

Fig. antenna You can view the source code from here.

Matlab Work: Optimum Cluster size, Number of cell and User support
Cellular mobile communication is one of the major branches of wireless communication which gives mobility and service to the user. The main technologies that are currently being used are GSM (Global System for Mobile) and CDMA (Code Division Multiple Access). In Nepal, NTC and Ncell have adopted GSM system, while Sky phone use CDMA technology. Although both GSM and CDMA divide their available frequency band into channels, the main difference between these two technologies is GSM uses certain number of frequency channels in a cell and each user get their own frequency channel, while CDMA uses only one frequency channel in a cell with proper allocation of PN (pseudo-random) code to each user. PN code is a special set of numbers which is mixed with the modulated signal during transmission and transmitted message can be decoded only with the same PN code. Analysis of GSM system with mathematical model in Matlab is very useful for communication design engineers. My work is to find the optimum cluster size, number of cell required and user support for a GSM system with the help of MATLAB GUI. I put some design equations in this GUI and created simple model as shown below.

A cluster is a group of cell with different set of frequencies. It can only be acceptable numbers like 1,3,4,7,9,12, so that cluster size 7 means there are only seven different cells in the system that use different frequencies and other cells are only the reused pattern of these cells. By knowing the suitable cluster size one can estimate the channel required and estimate the bandwidth of their system. Total number of cell refers simply to the number of towers required, i.e. cost of the system (Generally, one cell requires one tower for communication purpose). If we also know the area of a cell, than we can estimate the terrestrial coverage of the system. User support indicates the total number of users using the system. It helps to calculate percentage penetration. The input parameters required for this GUI are SNR (i.e. accepted level of signal to nose ratio; SNR=18 means systems SNR should not be less than 18dB), path loss (depends on the terrain or terrestrial condition like it is free space, village area or urban area; for urban n=4), GOS (measure of ability of user to access the trunked system, if GOS=2%, then out of 100 users trying to access a trunked system, 2 users are blocked and only 98 users can access the trunked system), Total area of cell and Channel per Cell(we have to specify at most channel the system can provide for a cell). Sectoring is the process of splitting a single cell into different sub-cells. I have given the facility of simulating the case of sectoring and type of cell area in this GUI. Sectoring options include (i) no

sectoring, (ii) 120o sectoring and (iii) 60o sectoring. Similarly types of cell area are differentiated as small, medium and large. Small cells refer to the average area of 1km 2, Medium cells refer to 5km2 and large cells refer to 10km2. Let us view the GUI simulation for the inputs and outputs as shown in figure.

Input are SNR=15 dB, path loss n=4, GOS=2%, total area of cell=2500 km 2, channel per cell=20, no sectoring and medium sized cells. So the cluster size we should use is of 7, i.e. we should use at least seven cell of different sets of frequencies. Using this scheme, we can cover 500 medium cell area and support up to 65500 users

You might also like