function varargout = GUI(varargin)
% GUI M-file for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI.M with the given input arguments.
%
% GUI('Property','Value',...) creates a new GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help GUI
% Last Modified by GUIDE v2.5 25-Nov-2008 20:28:58
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_OpeningFcn, ...
'gui_OutputFcn', @GUI_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 GUI is made visible.
function GUI_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 GUI (see VARARGIN)
% Choose default command line output for GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = GUI_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;
img=imread('vivek2.jpg');
imshow(img)
title('Dec 2008')
function [F]=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
F = str2double(get(hObject,'String'));
disp 'The freq of excitation in GHz'
F
save F
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function [L]=edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
L = str2double(get(hObject,'String'));
disp 'The length of cyl scan in meters'
L
save L
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function [rho]=edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (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 edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
rho = str2double(get(hObject,'String'));
disp 'The radius of scan in meters'
rho
save rho
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in Load Data.
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)
% Near Field To Far field Calculator and plotter
%%%%%%%%%%%%%%%%%%%%%%%%%% Initialization section.
%clc % clears the command window
%clear % clears variable
%%%%%%%%%%%%%%%%%%
load('F')
load('rho')
load('L')
load('fd1')
load('ff1')
r1=(size(fd1));
r2=(size(ff1));
%disp 'The Size of of Ez samples Matrix'
%(size(fd1))
%disp 'The Size of of Ephi samples Matrix'
%(size(ff1))
M=r1(1,1);
N=r1(1,2);
O=r2(1,1);
P=r2(1,2);
for p=1:M
REx(p,1)=fd1(p,4);
IEx(p,1)=fd1(p,7);
REz(p,1)=fd1(p,6);
IEz(p,1)=fd1(p,9);
end
Ephi=REx+i*IEx;
Ez=REz+i*IEz;
%disp 'The Size of of Ephi samples Matrix'
%(size(Ephi))
%disp 'The Size of of Ez samples Matrix'
%(size(Ez))
%%%%%%%%%%of Ez and E phi because of symmetry in phi
N=72 % 72 is the value of no. of phi cuts because of symmetry in phi
for p=1:M
for q=1:N % 72 IS THE VALUE OF PHI SAMPLES BECUSE OF SYMMETRY IN PHI
DEz(p,q)=Ez(p,1);
DEphi(p,q)=Ephi(p,1);
end
end
%save('DEz')
%save('DEphi')
%%%%%%%%%%Giving back values to
%%%%%%%%%%%%M X N Matrix of Ez because of symmetry in phi
for p=1:M
for q=1:N
Ez(p,q)=DEz(p,q);
Ephi(p,q)=DEphi(p,q);
end
end
%%%%%%% auto size readind%%%
disp 'The Size of of Ez samples Matrix'
(size(Ez))
disp 'The Size of of Ephi samples Matrix'
(size(Ephi))
r1=(size(Ez));
r2=(size(Ephi));
M=r1(1,1);
N=r1(1,2);
Lamda = (3*10^(-1))/F;
disp 'Wavelength in metres';
Lamda
k=2*pi/Lamda;
angle=L*0.5/rho; % in radians
Deg=ceil(atand(angle)); %%%%%%% angle in degrees
Theta=90-Deg;% % sherical co ord theta in degree
dtheta=linspace(Theta,180-Theta,M)*pi/180;
save
% --- Executes on button press in compute far field.
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)
load
%%%%%%%%% temp theta matrix
temp=dtheta';
%%%%%%%%%%Giving back values to M X N Matrix of theta because of symmetry
%%%%%%%%%%in phi
for p=1:M
for q=1:N
theta(p,q)=temp(p,1);
end
end
%%%%%%% h=k*cos M X N matrix
for p=1:M
for q=1:N
h(p,q)=k*cos(theta(p,q));
end
end
%%%%%%% r psition vector M X N matrix
for p=1:M
for q=1:N
r(p,q)=rho/cos(theta(p,q));
end
end
save('r','h','theta')
%%%%%%%%%% n (neeta) square=k^2-h(p,q)^2
for p=1:M
for q=1:N
neeta2(p,q)=(k^2-h(p,q)^2);
end
end
save('neeta2')
%%%%%%%%%%%% product of n and r =xeta
for p=1:M
for q=1:N
xeta(p,q)=(sqrt(neeta2(p,q)))*r(p,q);
end
end
%%%%%%%%%% Hankel co efficients (Hankel function of second order)
for p=1:M
for q=1:N
H(p,q) = besselh(0,2,xeta(p,q));
end
end
%%%%%%%%%% alpha n along with co efficent using FFT2 on Ez
for p=1:M
for q=1:N
an(p,q)=[k/((4*pi^2)*neeta2(p,q)*H(p,q))]*fft2(Ez(p,q));
end
end
%%%%%%%%%%%% Hankel derivative wrt propagation direction
format long e
for p=1:M
for q=1:N
H(p,q) = besselh(0,2,xeta(p,q));
end
end
J=real(H);
Y=-1*imag(H);
for q=1:N
j(1,q)=1;
y(1,q)=-3;
end
%%temp routine
for p=1:M
for q=1:N
j(p+2,q) = J(p,1);
y(p+2,q) = Y(p,1);
end
end
%%%%%%%% computing Hankel prime
for p=1:M
for q=1:N
Jp(p,q) = 0.5*(j(p,1)-J(p,1));
Yp(p,q) = 0.5*(y(p,1)-Y(p,1));
Hp(p,q) = (Jp(p,q)-i*Yp(p,q));
end
end
%%%%%%%%%% FFT2 of Ez term required for bn
for p=1:M
for q=1:N
fftEz(p,q)=fft2((h(p,q)*461/r(p,q))*Ez(p,q));
end
end
%%%%%%%%%%% FFT2 of Ephi term required for bn
for p=1:M
for q=1:N
fftEphi(p,q)=fft2((neeta2(p,q))*Ephi(p,q));
end
end
%%%%%%%%%%%%%%%%%%% beta n
for p=1:M
for q=1:N
bn(p,q)=(1/(4*pi^2)*neeta2(p,q)*Hp(p,q))*(fftEz(p,q)-fftEphi(p,q));
end
end
%%%To amend %%%%%%%%%%%% Far Field Etheta and Ephi
%
for m=1:M
for n=1:N
Tan(m,n)=((i^n))*sin(theta(m,n))*an(m,n);
end
end
for m=1:M
for n=1:N
Tbn(m,n)=i*(i^n)*sin(theta(m,n))*bn(m,n);
end
end
anFft=fft(Tan);
bnFft=fft(Tbn);
for r=1:M
for s=1:N
ethee(r,s)=i*sin(theta(r,s))*bnFft(r,s);
end
end
for p=1:M
for q=1:N
ephii(p,q)=sin(theta(p,q))*bnFft(p,q);
end
end
save('ethee')
save('ephii')
disp 'The Size of of ethee calculate Matrix'
(size(ethee))
disp 'The Size of of ephii calculated Matrix'
(size(ephii))
save
% --- 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)
% --- Executes on button press in Plot 3D.
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)
load
E1=ethee;
E2=ephii;
%%%%%%%%% random data check
%M=50;
%N=3;
%E1=rand(M,N);
%E2=rand(M,N);
%%%%%%%%%%%%For 3D plot in Db
Temp1=abs(E1).^2+abs(E2).^2;
for p=1:M
for q=1:N
amp(p,q)=10*log10(Temp1(p,q));
end
end
d1theta=linspace(90,-90,M)*pi/180;
d1phi=linspace(-180,180,N)*pi/180;
for j=1:M
for k=1:N
theta1(j,k)=d1theta(1,j);
phi1(j,k)=d1phi(1,k);
end
end
for j=1:M
for k=1:N
X(j,k)= cos(phi1(j,k))*cos(theta1(j,k))*amp(j,k);
Y(j,k)= cos(theta1(j,k))*sin(phi1(j,k))*amp(j,k);
%X(j,k)= phi1(j,k);
%Y(j,k)=theta1(j,k);
end
end
T=length(d1theta)-ceil(M/2);
for j=1:T
for k=1:N
Z (j,k)=sin(theta1(j,k))*amp(j,k);
end
end
for j=T+1:M
for k=1:N
Z (j,k)=sin(theta1(j,k))*amp(j,k);
end
end
%colormap([0 0 0;1 1 1])
%figure
surf(X,Y,Z)
%hold
title('3D plot of far field');
legend('far Field (Db)');
%colormap hot
axis square
save
% --- Executes on button press in 2D phi=0 cut.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%%%%%%%for polar plot at phi=0 cut
% degrees and plot on the same graph with autoscaling.
load
size(d1theta)
alpha=d1theta';
for j=1:length(alpha)
D1(j,1)=amp(j,1);
end
%figure
polar(alpha,D1,'b');
%hold
title('polar plot at phi=0 cut');
legend('far Field (Db)');
save
% --- Executes on button press for polar plot at theta=0 cut
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load
t=ceil(M/2);
for j=1:length(d1phi)
D2(1,j)=amp(t,j);
end
%figure
polar(d1phi,D2,'red');
%hold
title('polar plot at theta=0 cut');
legend('far Field (Db)');
save
% --- Executes on button press for reset data.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all
clc
% --- Executes on button press for exit.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
closereq
% --- Executes on button press for saving figure.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%save fig
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load
figure
surf(X,Y,Z)
hold
title('3D plot of far field');
legend('far Field (Db)');
%colormap hot
axis square
save