0% found this document useful (1 vote)
68 views4 pages

Function Axes1

This document contains MATLAB code for drawing a Smith chart. It includes functions for plotting various circles that make up the chart, including the outer unit circle as well as additional concentric circles along the horizontal and vertical axes. It also contains code for plotting lines, setting axis properties, and displaying text values on the chart. The overall purpose is to generate a Smith chart for use in signal transmission analysis.

Uploaded by

Alex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
68 views4 pages

Function Axes1

This document contains MATLAB code for drawing a Smith chart. It includes functions for plotting various circles that make up the chart, including the outer unit circle as well as additional concentric circles along the horizontal and vertical axes. It also contains code for plotting lines, setting axis properties, and displaying text values on the chart. The overall purpose is to generate a Smith chart for use in signal transmission analysis.

Uploaded by

Alex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

% CARTA DE SMITH

% NOMBRE: ALEX FERNANDO MAGNE RAMOS C.I.12429593


% MATERIA: MEDIOS DE TRANSMISION ELT 2532 "A"
% 17 DE DICIEMBRE DEL 2018.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
function edit1_Callback(hObject, eventdata, handles)
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
function edit2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)


function edit3_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
global zore zoim zlre zlim ynorm zo zl x1 y1 tita
zore=str2double(get(handles.edit1,'string'))
zoim=str2double(get(handles.edit2,'string'))
zlre=str2double(get(handles.edit3,'string'))
zlim=str2double(get(handles.edit4,'string'))
zo=sqrt(zore^2+zoim^2)
zl=sqrt(zlre^2+zlim^2)
ynorm=zl/zo
if(zo==0)
else
t=0:0.1:2*pi;
x1=ynorm*cos(t);
y1=ynorm*sin(t);
plot(x1,y1,'linewidth',3)
xlim([-1 1])
ylim([-1 1])
end
tita=tan(atan(zlim/zlre)-atan(zoim/zore))

drawArrow = @(x,y,varargin) quiver(y(1),y(2),x(1),x(2),0,varargin{:})


x=[ynorm*sin(tita+pi/2) ynorm*cos(tita+pi/2)]
y=[0 0]

drawArrow(x,y,'linewidth',3,'color','k'); hold on
set(handles.text7,'string',ynorm)
set(handles.text8,'string',(pi/2+tita))
set(handles.edit8,'string',((1+ynorm)/(1-ynorm)))
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)

%Dibujamos nuestra circunferencia exterior


t=linspace(0,2*pi,100);
x=cos(t);
y=sin(t);
plot(x,y,'linewidth',3);axis equal;

%Ponemos el titulo
title('Carta de Smith')
set(gca,'xticklabel',{[]});
set(gca,'yticklabel',{[]});
hold on

%Dibujamos circunferencias a lo largo del eje horizontal


k=[.1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.2 1.4 1.6 1.8 2 3 4 5 10 20 50];
for i=1 : length(k)
x(i,:)=k(i)+(1-k(i))*cos(t);
y(i,:)=(1-k(i))*sin(t);
plot(x(i,:), y(i,:), 'k')
end

%Dibujamos circunferencias a lo largo del eje vertical


kt=[-0 2 4 5 2.5 pi 3.79 4.22 ];
k=[.02 .05 .1 .2 .25 .33 .5 .55 .625 0.714 0.833 1 1.1 1.25 1.428 1.67 2 2.5
3.3 5 10];
for i=1 : length(k)
t=0:0.001:2*pi;
a(i,:)=1+k(i)*cos(t);
b(i,:)=k(i)+k(i)*sin(t);
plot(a(i,:), b(i,:), 'k', a(i,:), -b(i,:),'k')

end
r=-1:0.1:1
u=0*r
plot(r,u)
xlim([-1 1])
ylim([-1 1])
function pushbutton1_ButtonDownFcn(hObject, eventdata, handles)
function edit4_Callback(hObject, eventdata, handles)
function edit4_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit5_Callback(hObject, eventdata, handles)


function edit5_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit6_Callback(hObject, eventdata, handles)
function edit6_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit7_Callback(hObject, eventdata, handles)
function edit7_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit8_Callback(hObject, eventdata, handles)


function edit8_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

%CARTA DE SMITH EN MATLAB


function draw_smith_chart
%Dibujamos nuestra circunferencia exterior
t=linspace(0,2*pi,100);
x=cos(t);
y=sin(t);
plot(x,y,'linewidth',3);axis equal;

%Ponemos el titulo
title('Carta de Smith')
set(gca,'xticklabel',{[]});
set(gca,'yticklabel',{[]});
hold on

%Dibujamos circunferencias a lo largo del eje horizontal


k=[.25 .5 .75];
for i=1 : length(k)
x(i,:)=k(i)+(1-k(i))*cos(t);
y(i,:)=(1-k(i))*sin(t);
plot(x(i,:), y(i,:), 'k')
end

%Dibujamos circunferencias a lo largo del eje vertical


kt=[2.5 pi 3.79 4.22];
k=[.5 1 2 4];
for i=1 : length(kt)
t=linspace(kt(i), 1.5*pi, 50);
a(i,:)=1+k(i)*cos(t);
b(i,:)=k(i)+k(i)*sin(t);
plot(a(i,:), b(i,:), 'k', a(i,:), -b(i,:),'k:')
end

You might also like