RE:Diagrama de radiacion de un dipolo
Publicado por
oso (1 intervención) el 21/09/2011 07:12:28
yo hice este ejemplo pa matlab por si a alguien le interesa
esta en matlab 2009
function varargout = Dipolo_2Dy3D(varargin)
% DIPOLO_2DY3D M-file for Dipolo_2Dy3D.fig
% DIPOLO_2DY3D, by itself, creates a new DIPOLO_2DY3D or raises the existing
% singleton*.
%
% H = DIPOLO_2DY3D returns the handle to a new DIPOLO_2DY3D or the handle to
% the existing singleton*.
%
% DIPOLO_2DY3D('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DIPOLO_2DY3D.M with the given input arguments.
%
% DIPOLO_2DY3D('Property','Value',...) creates a new DIPOLO_2DY3D or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Dipolo_2Dy3D_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Dipolo_2Dy3D_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 Dipolo_2Dy3D
% Last Modified by GUIDE v2.5 10-Sep-2011 00:51:00
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Dipolo_2Dy3D_OpeningFcn, ...
'gui_OutputFcn', @Dipolo_2Dy3D_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
% End initialization code - DO NOT EDIT
% --- Executes just before Dipolo_2Dy3D is made visible.
function Dipolo_2Dy3D_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 Dipolo_2Dy3D (see VARARGIN)
% Choose default command line output for Dipolo_2Dy3D
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
end
% UIWAIT makes Dipolo_2Dy3D wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Dipolo_2Dy3D_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;
end
% --- 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)
phi=(0:.01:1)*2*pi; %phi de 0 a 2pi
theta=(0:.01:1)*pi; %th de 0 a pi
thp=(0:.01:1)*2*pi;
for l=0.1:0.1:3;
% todos los valores para theta 2D
%grafica en 3D
%creación del meshgrid tipica para crear graficas 3d
[PHI,THETA]=meshgrid(phi,theta,thp);
[THP]=meshgrid(thp);
%creación del campo
E1=abs(((cos(pi.*cos(THETA).*l))-cos(pi.*l))./(sin(THETA)));
%cambio de coordenadas esfericas a rectangulares para graficar en 3D
X=E1.*sin(THETA).*cos(PHI);
Y=E1.*sin(THETA).*sin(PHI);
Z=E1.*cos(THETA);
%normalizacion para cada x,y, z
tx=max(X);
ax=tx';
ux=max(ax);% valor maximo en x e y
tz=max(Z);
az=tz';
uz=max(az); %valor maximo para z
u=max(ux, uz);
% obtencion de los ejes normalizados
X=X./u;
Y=Y./u;
Z=Z./u;
mesh(X,Y,Z,E1);
axes(handles.axes1);
polar(THETA,E1);
view([90 -90]);
axes(handles.axes2);
end
end
esta hecho con gui ademas enton tienen que hacer el gui con un boton y una grafica