How to plot Smith chart?
    조회 수: 54 (최근 30일)
  
       이전 댓글 표시
    
Hello. I need to plot Smith chart, having frequency, VSWR, reflection coefficient and phase. I'm fairly new to matlab environment and not sure how to achieve it. Tried already this from mathworks website, it didn't even seemed remotely okay. As it says, I've tried to plot reflection coefficient as gamma. Screen with my data and result I've got:

댓글 수: 2
  Muhammad Syafiq Bin Salahudin
 2019년 3월 5일
				Hi,
Is there any way to compile these codes into MATLAB App GUI?
  Janakinadh
    
 2021년 6월 8일
				Usage:
smithplot('Parent', uipanel)
You can use appdesigner to easily build App GUI in MATLAB. That App can have a smithplot live in a panel.
Also see: Matching Network App where a smithplot is plotted in an uipanel to plot S-parameters and impedance transformation. 
채택된 답변
  John BG
      
 2016년 12월 2일
        
      편집: Stephen23
      
      
 2017년 11월 26일
  
      Hi Mr Taker
There are many ways to plot data on MATLAB Smith charts
1.- basic plot of single impedance
clc;clear all;format long; 
Z0=100;sm1=smithchart;
ZL1=150-1j*200;f0=3e9; % Hz
gamma_L=(ZL1-Z0)/(ZL1+Z0); 
% show ZL1 on Smith chart adding text showing values
if imag(ZL1)<0
sign1='-';
else
    sign1='+';
end
hold all;plot(real(gamma_L),imag(gamma_L),'ro','LineWidth',1.5);
str1=['ZL =' num2str(real(ZL1)) sign1 'j' num2str(abs(imag(ZL1))) ' \rightarrow'];
text(real(gamma_L),imag(gamma_L)+.01,str1,'Color','blue','FontSize',20,'HorizontalAlignment','right','VerticalAlignment','middle');

2.- solving a basic single stub ZLoad match:

the functions I use are as follows:
function [x_data,y_data]=Smith_plotGammaCircle(ax,Z,Z0)
% plot SWR circle, lossless TL
gamma=z2gamma(Z,Z0);  
r=abs(gamma); 
alpha=0:2*pi/100:2*pi;                                       
hold all;
sub_hp2=plot(ax,r*cos(alpha),r*sin(alpha),'-','LineWidth',.5,'Color',[1 .2 0])   
x_data=sub_hp2.XData
y_data=sub_hp2.YData
end
function Smith_plotRefLine2PhaseCircle(ax,Z,Z0)
% plot reference line from origin through ZL to phase reference circle
gamma_L=z2gamma(Z,Z0);                                
a=atan(imag(gamma_L)/real(gamma_L));
plot(ax,[0 cos(a)],[0 sin(a)],'Color',[0 0.7 0],'LineWidth',1)           
end
function a=Smith_plotRefLine2PhaseCircle(ax,Z,Z0)
% plot reference line from origin oppsite to ZL to phase reference circle
% it plots ref line through YL
gamma_L=(Z-Z0)/(Z+Z0)
a=angle(gamma_L)
plot(ax,[0 -real(exp(1j*a))],[0 -imag(exp(1j*a))],'Color',[0 0.7 0],'LineWidth',1)           
end
function Smith_plotZ(ax,Z,Z0)
% add text showing ZL R+jX data, Smith Chart generated externally
gamma=z2gamma(Z,Z0);  
plot(ax,real(gamma),imag(gamma),'ro','LineWidth',1.5)
if imag(Z)<0
sign1='-';
else
    sign1='+';
end
hold all;plot(ax,real(gamma),imag(gamma),'ro','LineWidth',1.5);
str1=['ZL =' num2str(real(Z)) sign1 'j' num2str(abs(imag(Z))) ' \rightarrow'];
text(ax,real(gamma),imag(gamma)+.01,str1,'Color','blue','FontSize',20,'HorizontalAlignment','right','VerticalAlignment','middle');
end
3.- adding reactance/resistance circle sections and a legend
Z0=75; ZL=90+1j*60;
sm1=smithchart; ax=gca; hold all; 
sm1.Values = [.1 .2 .3 .5 1 1.5 2 3.5 5;1 1.5 2 3.5 5 5 5 15 30]
sm1.SubColor=[.2 .2 .2]
gamma_ZL=(ZL-Z0)/(ZL+Z0); gamma_YL=-gamma_ZL
plot(ax,real(gamma_ZL),imag(gamma_ZL),'ro','LineWidth',1.5)
plot(ax,real(gamma_YL),imag(gamma_YL),'bo','LineWidth',1.5)
hl1=legend(ax,{'ZL','YL'}, 'Location','bestoutside');title(hl1,'points')
Smith_plotRefLine2PhaseCircle(ax,ZL,Z0)
[x_circ1,y_circ1]=Smith_plotGammaCircle(ax,ZL,Z0);
[x_circ2,y_circ2]=Smith_plotRcircle(ax,Z0,Z0);
[x_target,y_target]=kreuzungen(x_circ1,y_circ1,x_circ2,y_circ2)
plot(ax,x_target(1),y_target(1),'ro','LineWidth',1.5)
plot(ax,x_target(2),y_target(2),'ro','LineWidth',1.5)

The function kreuzungen appended to these lines was developed by Douglas M. Schwarz dmschwarz=ieee*org, dmschwarz=urgrad*rochester*edu function available in this forum too.
4.- there are different custom toolboxes available in MATLAB file exchange. One that allows to set Z0 as input to a Smith chart related function of the tool set is
by Neil Tucker
The drawback of Tucker's is that his core function is named exactly as MATLAB RF toolbox smith, the problem being that while MATLAB’s smith does not take in Z0, MATLAB's smith only plots normalised impedances/admittances. When attempting to call Tucker's smith MATLAB returns zero, I got it working by renaming Tucker's smith function.
5.- Although encouraging Smith chart functions development with MATLAB, I am now learning KEYSIGHT ADS, and it's the right tool to solve RF circuits with Smith Chart plots.
.
So, Taker if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG
EDIT: deleted Douglas Schwarz's copyright code.
댓글 수: 4
  John BG
      
 2017년 8월 10일
				Hi Ammar Babikir
there is an early (2003) collection of functions available in the MATLAB file exchange that has a function called smith.
When one tries to run that smith function, that has many input fields, the same error message shows up.
There's this other group of Smith chart related functions
that has a function called exactly smithchart, and again, it's going cause anything but conflict.
So, make sure that whatever other Smith chart tools you may have downloaded, for earlier MATLAB versions, for evaluation, make sure that the files are not in the MATLAB working folder.
Regards
John BG
  Harrison Norris
 2020년 11월 13일
				Hey, looking through your code. How does your Smith_plotRcircle function work and I can find no mention of any kind of kreuzungen function other than on this page. I know its been awhile since posting, just looking for Info.
Thanks,
Harrison Norris
추가 답변 (1개)
  MathWorks Support Team
    
 2022년 3월 7일
        Usage:
smithplot('Parent', uipanel)
You can use appdesigner to easily build App GUI in MATLAB. That App can have a smithplot live in a panel.
Also see: Matching Network App where a smithplot is plotted in an uipanel to plot S-parameters and impedance transformation. 
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Visualization and Data Export에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






