rf transmission line simulation and design tool

53
T.C. BAHÇEŞEHİR UNIVERSITY RF TRANSMISSION LINE SIMULATION AND DESIGN TOOL Capstone Project Saliha Kaykun Advisor: Ph.D.Babur Hadimioglu İSTANBUL, 2011

Upload: saliha-kaykun

Post on 06-Nov-2015

36 views

Category:

Documents


3 download

DESCRIPTION

This paper mentioned about radio frequency transmission line simulation and design tool. Many graphics and non-graphics based tools have been developed to support various areas of radio frequency and microwave engineering. Radio frequency transmission line solutions are analyzed by various methods. In this Project, method is Matlab GUI. This program is used, depending on the user’s request and to supply graphical interface. This Project does Matlab GUI in solving the single stub, double stub problems and solving single stub problems, as well as no matching network case. When the solution of transmission line problems solving with Matlab GUI, it show Smith Chart and plot the frequency and magnitude reflection coefficient. The using of Matlab GUI is common at the market.

TRANSCRIPT

  • T.C.

    BAHEEHR UNIVERSITY

    RF TRANSMISSION LINE SIMULATION

    AND

    DESIGN TOOL

    Capstone Project

    Saliha Kaykun

    Advisor: Ph.D.Babur Hadimioglu

    STANBUL, 2011

  • T.C.

    BAHEEHR UNIVERSITY

    FACULTY OF ENGINEERING

    DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

    RF TRANSMISSIN LINE SIMULATION

    AND

    DESIGN TOOL

    Capstone Project

    Saliha Kaykun

    Advisor:Ph.D. Babur Hadimioglu

    STANBUL, 2011

  • T.C.

    BAHEEHR UNIVERSITY FACULTY OF ENGINEERING

    DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

    Name of the project: Rf transmission line simulation and design tool Name/Last Name of the Student: Saliha Kaykun

    Date of Thesis Defense: 20/06/2011

    I hereby state that the graduation project prepared by Saliha Kaykun has been

    completed under my supervision. I accept this work as a Graduation Project.

    20/06/2011

    Babur Hadimioglu

    I hereby state that I have examined this graduation project by Saliha Kaykun which

    is accepted by his supervisor. This work is acceptable as a graduation project and the student is eligible to take the graduation project examination.

    20/06/2011 Asst. Prof. Cigdem Eroglu

    We hereby state that we have held the graduation examination of Your Name and agree that the student has satisfied all requirements.

    THE EXAMINATION COMMITTEE

    Committee Member Signature

    1. Babur Hadimioglu ..

    2. .. ..

    3. .. ..

  • ii

    ACADEMIC HONESTY PLEDGE

    In keeping with Baheehir University Student Code of Conduct, I pledge that this work is

    my own and that I have not received inappropriate assistance in its preparation.

    I further declare that all resources in print or on the web are explicitly cited.

    NAME DATE SIGNATURE

  • iii

    ABSTRACT

    RF TRANSMISSION LINE SIMLUATION AND DESIGN TOOLS

    Saliha Kaykun

    Faculty of Engineering Department of Electrical & Electronics Engineering

    Advisor:Ph.D. Babur Hadimioglu

    JUNE, 2011, 43pages

    This paper mentioned about radio frequency transmission line simulation and

    design tool. Many graphics and non-graphics based tools have been developed to support

    various areas of radio frequency and microwave engineering. Radio frequency

    transmission line solutions are analyzed by various methods. In this Project, method is

    Matlab GUI. This program is used, depending on the users request and to supply graphical

    interface. This Project does Matlab GUI in solving the single stub, double stub problems

    and solving single stub problems, as well as no matching network case. When the solution

    of transmission line problems solving with Matlab GUI, it show Smith Chart and plot the

    frequency and magnitude reflection coefficient. The using of Matlab GUI is common at the

    market.

    Key Words: transmission line, simulation, matching network, single stub, double

    stub, matlab GUI, design tool, Smith Chart

  • iv

    ZET

    RADYO FREKANS ARALIINDAK LETM HATLARININ SMULASYONU VE ARA KUTUSU DZAYNI

    Saliha Kaykun

    Mhendislik Fakltesi

    Elektrik-Elektronik Mhendislii Blm

    Tez Danman: Babur Hadimioglu

    HAZRAN,2011 ,43 sayfa

    Bu raporda, radyo frekans iletim hatlarnn simlasyonu ve ara kutusu yapmaktan

    bahsetmektedir.Bu projede,metod ise Matlab GUI dir.Bu program kullancsnn isteklerine

    baldr ve grsel arayz salar. Radio frekans iletim hatlar;single stub,double stub ve

    matching networksuzdur.Problemleri Matlab GUI de yapld. letim hatlarnn problem

    zmlerini matlab GUI yardmyla, Smith chart ve frekans ve yansma katsays grafiiyle

    gstermektedir.Matlab GUI piyasa da sk kullanlan bir programdr.

    Anahtar Kelimeler: iletim hatt, simlasyon, Smith Chart, empedans uydurma,

    tek yan,ift yan,matlab GUI

  • v

    TABLE OF CONTENTS

    ABSTRACT...........................................................................................................................iii

    ZET .................................................................................................................................... iv

    TABLE OF CONTENTS....................................................................................................... v

    LIST OF TABLES ................................................................................................................ vi

    LIST OF FIGURES ..............................................................................................................vii

    1. INTRODUCTION ............................................................................................................. 1

    2. Modeling Transmission Lines............................................................................................ 1

    2.1. Transmission Line.................................................................................................. 1

    2.2. Matching Network ................................................................................................. 4

    2.2.1 Single Stub ...................................................................................................... 5

    2.2.1 Double Stub.. ..6

    3. Simulation & Design Tool ................................................................................................. 7

    4. Conclusion ............................................................................................... 19

    APPENDIX A ...................................................................................................................... 20

    APPENDIX B ...................................................................................................................... 21

    REFERENCES .................................................................................................................... 43

  • vi

    LIST OF TABLES

    Table 1.Transmission Line Characteristics ............................................................................ 2

  • vii

    LIST OF FIGURES

    Figure 1. Transmission Line .................................................................................................. 2

    Figure 2. Load Impedance Formula ...................................................................................... 3

    Figure 3. Input Impedance Due to a Line Terminated by a Load .......................................... 3

    Figure 4. Matching Network .................................................................................................. 5

    Figure 5. Single Shunt and Series Stub Circuited Short and Open........................................ 6

    Figure 6. Double Shunt and Series Stub Circuited Short and Open ..................................... 7

    Figure 7. Matlab GUI for Solving Transmission Line........................................................... 9

    Figure 8. Solution for No Matching Network Case ............................................................... 9

    Figure 9. No matching network case .................................................................................... 9

    Figure 10. Single Shunt Stub Matlab GUI ........................................................................... 11

    Figure 11. Solution 1 for Single Shunt Stub ........................................................................ 12

    Figure 12. Solution 2 for Single Shunt Stub ........................................................................ 12

    Figure 13. Solution for Single Shunt Stub .......................................................................... 12

    Figure 14. Single Series Stub Matlab GUI .......................................................................... 14

    Figure 15. Soluiton 1 for Single Series Stub........................................................................ 14

    Figure 16. Solution 2 for Single Series Stub....................................................................... 15

    Figure 17. Solution for Single Series Stub.......................................................................... 15

    Figure 18. Double Shunt Stub Matlab GUI ......................................................................... 17

    Figure 19. Solution 1& Solution 2 for Double Shunt Stub ................................................ 17

    Figure 20. Solution for Double Shunt Stub ......................................................................... 18

  • 1

    1. INTRODUCTION

    This paper introduces radio frequency line simulation and design tool. This goal of

    this project is to design a tool for transmission line. Also this project, I choose to use the

    wide range of areas such communication and it has an abstract concept. When abstract

    concepts changes concrete concepts, it is noteworthy. Transmission line is used for military

    industry, communication, aerospace etc. Transmission lines are commonly used in power

    distribution (low frequency) and in communications (high frequency).RF transmission

    lines are high frequencies so I do not lumped element this project. Transmission line needs

    analysis for use in these areas. Transmission line has some formulas. According to the case

    and parameters, transmission line operates mathematically. Types of transmission line uses

    coaxial line, two-wire line a parallel-plate etc. Particular transmission line uses coaxial

    lines. The problem of transmission lines are solved using circuit theory and

    electromagnetic field theory. Transmission line is used to serve different purposes. I

    consider how transmission lines are used for load matching and impedance measurements.

    Types of matching network are single stub and double stub. Transmission line needs

    analysis for use in these as a result of their, computer programmer is analyzed by. These

    concepts are better proffered by attach modern tools, such as Matlab for a certain analysis

    of the problem and the display of the outcomes. This paper focuses on the oncoming used

    to manage projects for solving single stub and double stub transmission line problem with

    the Smith Chart using the scripts that were developed by the user. Simulation is used to

    confirm for accuracy. It is simulated by manual programs. Simulation is the theoretical into

    practical tab. Construction phase of this project will continue as follows

    Modeling Transmission line

    Simulation & Design Tool

    Conclusion

    1. Modeling Transmission Lines

    2.1 Transmission Line

    A transmission line is a device designed to guide electrical energy from one point to

    another [1]. Transmission lines are used for military industry, communication etc.

  • 2

    Transmission line problems are solved using electromagnetic field theory and electric

    circuit theory. The type of transmission lines are coaxial cable, a two-wire line, a parallel-

    plate, a microstrip plane etc. Transmission lines have circuit components. The line

    parameters are resistance per unit length R, inductance per unit L, conductance per unit

    length G, and capacitance per unit length C.

    Figure1: Transmission Line

    In this project, transmission lines are solved using parameters. This parameters are speed

    (Vp/c), propagation constant ( ), phase constant ( ), length , and the characteristic

    impedance ( ).Cases of transmission line are lossless and low-loss. A case is the low loss

    transmission line, where the reactive elements still take over but R and G cannot be

    neglected as in a loss-line. 50 ohms is the most commonly used characteristic impedance. I

    use the formula of transmission line at figure2.

    Table1: Transmission Line Characteristics

    Load impedances parameters are R, C, L. Load impedance calculates series or parallel. Its

    solving way is at figure 2

  • 3

    Figure 2: Load Impedance Formulas

    Input impedance is solved by Thevenin's equivalent circuit of the electrical network and

    input impedance has formulas for example, input impedance has two formulas.

    Figure 3: Input impedance due to a line terminated by a load

    The input impedance (Zin), at distance from the load then. Its formulas are for

    (Low Loss) (1)

    (Lossless) (2)

    For this formulas becomes showing that the input impedance varies periodically with

    distance l from the load. The quantity Bl in usually referred to as the electrical length of

    the line and can be expressed in degrees or radians. The reflection coefficient can be given

    by the equations below, where Zo is the impedance toward the source; ZL is the impedance

    toward the load: [2]

  • 4

    (3)

    The standing wave ratio is the measurement of maximum voltage to minimize voltage on a

    transmission line and measures the perfection of the termination of the line. A ratio of 1:1

    describes a line terminated in its characteristic impedance.

    (4)

    The Smith Chart (Appendix A) is the most commonly used of graphical techniques in

    solving high-frequency transmission line problems. Although there are a number of other

    impedance and reflection coefficient chart that can be used for problems, the Smith chart is

    probably the best known .The reflection coefficient is displayed graphically using a Smith

    Chart. It is basically a graphical indication of the impedance of a transmission line as one

    move along the line. The smith chart convert from the reflection coefficients to normalized

    impedance and using the impedance circle printed on the chart. The locations of standing

    wave ratio along the transmission line can be located using the Smith chart given that these

    values correspond to specific impedance characteristics.

    2.2 Matching Network

    In many transmission-line applications, it is desired to match the load impedance to

    the characteristic Impedance of the line and riddle reflections in order to maximize the

    power delivered to the load and minimize signal distortion and noise. [3] In practice, the

    impedance of a given load is different from the characteristic impedance of the

    transmission line, and an additional impedance transformation network is needed to

    achieve a matched load condition.

    Factors in selection of a particular matching network

    Complexity

    Bandwidth

    Implementation

    Adjustability

  • 5

    Figure 4: Matching Network

    Types of matching network are single stub, double stub, triple stub and quarter-

    wave. In this project, I implemented two of matching network and I implemented single

    stub and double stub. The transmission line actualizing the stub is normally completed by

    an open or by a short. In many cases it is also it is suitable to choose the same

    characteristic impedance used for the main line, though this is not necessary. The choice of

    open or shorted stub will be based on practice on factors. A short stub is tents to escape

    of electromagnetic radiation. Otherwise, an open stub is more practical than short stub. I

    selected to clear open circuited stub or short circuited stub.

    2.2.1 Single Stub

    A single open circuited or short circuited stub can connect in either parallel or series with

    the line to achieve impedance matching. The tuner consists of open or shorted section of

    transmission line of length connected in parallel with the main line at some distance d

    from the load as figure 5.

    Figure 5: Single shunt and series stub circuited short and open

    Two adjustable parameters are

    The distance, d, from the load to the stub position

  • 6

    The value of susceptance or reactance provided by shunt or series stub

    Single stub steps on Smith chart;

    Locate the normalized load impedance ,ZL;

    Draw the SWR circle and determine the line admittance

    Move toward the load until you cross the r=1 circle

    At this point ,the line admittance =1+jb

    Add in a shunt load with input admittance=-jb

    At this point ,the normalized admittance=1.Thus ,the line is matched the load

    Single stub is a method of matching network. Single stub is to reactively load the line with

    a shunt load rendering the net line impedance equal to the characteristic impedance. [4]

    Matching can be supplied by adding two stubs at specified locations along transmission

    line.

    2.2.1 Double Stub

    A double open circuited or short circuited stub can connect in either parallel or series with

    the line to achieve impedance matching.

    Figure 6: Double shunt and series stub circuited short and open

    Double stub steps on Smith chart;

    Locate the normalized load impedance ,ZL;

  • 7

    locate the corresponding admittance, yL ;

    move yL d away from the load end to y1 ;

    draw the rotated unit circle;

    move along the resistance circle of y1 to the

    interaction of the rotated unit circle, y2 ;

    move along the resistance circle of y1 to the interaction of the rotated unit circle, y2

    compute the first shortest length, l1 , based on the susceptance difference between

    y1 and y2 ;

    move y2 to y3 on the intended unit circle by rotating the rotated unit circle d

    clockwise;

    compute the second shortest length, l2 , based on the susceptance of y3 .

    The double stub,which uses two tuning stubs in fixed positions,can be used.Such tuners are

    often fabricated in coaxial line,with adjustable stubs connected in parallel to the main

    coaxial line.Double stub tunner cannot match all load impedances.Shunt stub is usually

    easier to implement in practice than series stubs.

    3. Simulation & Design Tool

    Due to advancement of technology, RF transmission lines calculate easier.

    These technologies are software programs. At this project, using of transmission lines will

    be low- loss line and lossless. This work is range of radio frequency. Frequency range of

    radio frequencies is a rate of oscillation in the range of about 30 kHz to 300 GHz. I made

    simulation. In this project, I implemented analytic solution of matching network. It is

    helped to make matlab program about solving in transmission line. After to understand

    analytic solution, I wrote code script. When solving problems, I have used to reference

    Microwave Engineering (David M. Pozar ) [4] for analytic solution. First of all; I place the

    desired parameter on Matlab GUI. I design to connect using the transmission line

  • 8

    components. Then I write matlab coding m-file (Appendix B). This paper focuses on the

    approach used to conduct projects for solving stub transmission line problem with the

    Smith Chart using the scripts that were developed by the authors.

    Example Program

    A 0.0001m-long low-loss transmission line with Zo=50 ohm operating at 2 GHz is

    terminated with a load ZL=60-j80 ohm. If Vp/c=0.6c on the line. The process is illustrated

    starting with figure 7where complex value of ZL is indicated by the user. Depending upon

    the input variables and selections made by user while defining the inputs for the selected

    design, the appropriate parameters are calculated and displayed. The first result displayed

    in this case figure7 is a plot of reflection coefficient versus frequency for each of the single

    stub solutions that are possible. The final results are displayed in the Smith chart such as

    figure 8. It is showed start frequency and stop frequency in smith chart by.

    Figure 7: No matching network case

  • 9

    Figure 8: Solution for no matching network case

    Figure 9: No matching network case solution

    Single Shunt Stub Analytic Solution

    To derive formulas for d and l , let the load impedance be written as ZL=1/YL=RL+jXL.

    Then the impedance Z down a lenght d,of line from the load is

    Where t=tand. The admittance at this point is

    Where

  • 10

    Now d is chosen so that G=Yo=1/Zo. From this results is an quadratic equation for t;

    If RL=Zo, then t=-XL/2Zo.Thus,the two principal solutions for d are

    =

    To find the required stub lengths, first use t find the stub susceptance, Bs=-B. Then, for an

    open-circuited stub,

    = ,

    While for a short-circuited stub,

    (

    If the length given lo or ls is negative, /2 can be added to give a positive result.

    Another Program Example

    A single shunt stub short circuited matching network for a load impedance of ZL=60-j80

    ohm is shown as an example. The line impedance is 50 ohm and design frequency is 2

    Ghz. The process is illustrated starting with figure 10 where complex value of ZL is

    indicated by the user. Depending upon the input variables and selections made by user

    while defining the inputs for the selected design, the appropriate parameters are calculated

    and displayed. The first result displayed in this case figure10 is a plot of reflection

    coefficient versus frequency for each of the single stub solutions that are possible. The

    final results are displayed in the Smith chart such as figure 11 and figure 12. It is showed

    start frequency and stop frequency in smith chart by.

  • 11

    Figure 10: Single Shunt Stub Matlab GUI

    The final result is showing the Smith chart

    Figure 11: Solution 1 for Single Shunt Stub

  • 12

    Figure 12:Solution2 for Single Shunt Stub

    Figure 13: Solution for Single Shunt Stub

    Single Series Stub Analytic Solution

    To derive formulas for d and l, let the load impedance be written as YL=1/ZL=GL+jBL.

    Then the impedance Y down a lenght d,of line from the load is

    Where t=tand. The admittance at this point is

  • 13

    Where

    Now d is chosen so that R=Zo=1/Yo. From this results is an quadratic equation for t;

    If RL=Zo, then t=-XL/2Zo.Thus,the two principal solutions for d are

    =

    To find the required stub lengths, first use t find the stub susceptance, Xs=-X. Then, for an

    open-circuited stub,

    = ,

    While for a short-circuited stub,

    (

    If the length given lo or ls is negative, /2 can be added to give a positive result.

    Another Program Example

    A single series stub matching network for a load impedance of ZL=100+j80 ohm is shown

    as an example. The line impedance is 50 ohm and design frequency is 2 Ghz. The process

    is illustrated starting with figure 14 where complex value of ZL is indicated by the user.

    Depending upon the input variables and selections made by user while defining the inputs

    for the selected design, the appropriate parameters are calculated and displayed. The first

    result displayed in this case figure14 is a plot of reflection coefficient versus frequency for

    each of the single stub solutions that are possible. The final results are displayed in the

  • 14

    Smith chart such as figure 15 and figure 16. It is showed start frequency and stop

    frequency in smith chart by.

    Figure 14: Single Series Stub Matlab GUI

    The final result is showing the Smith chart

    Figure 15: Solution 1 for single series stub

  • 15

    Figure 16: Solution 2 for single series stub

    Figure 17: Solution for single series stub

    Double Shunt Stub Analytic Solution

    Where YL=GL+jBL; is load admittance and B1 is the susteptance of the first stub.After

    transforming through a length d of transmission line,admittance just to the right of the

    second stub is

  • 16

    Where t=tanBd and Yo=1/Zo.At this point,the real part of Y2 must equal Yo,which leads

    to the equation

    that can be matched for a given stub spacing, d. After d has been ,the first stub susceptance

    can be determined from as

    Then the second stub substance can be found from the negative of the imaginary part of to

    be

    The upper and lower signs in correspond to the same solution.the open circuited stub

    length is found as

    = ,

    While the short circuited stub length is found as

    (

    Another Program Example

    A double parallel stub matching network for a load impedance of ZL=60-j80 ohm is shown

    as an example. The line impedance is 50 ohm and design frequency is 2 Ghz. The process

    is illustrated starting with figure 18 where complex value of ZL is indicated by the user.

    Depending upon the input variables and selections made by user while defining the inputs

    for the selected design, the appropriate parameters are calculated and displayed. The first

  • 17

    result displayed in this case figure18 is a plot of reflection coefficient versus frequency for

    each of the single stub solutions that are possible. The final results are displayed in the

    Smith chart such as figure 19. It is showed start frequency and stop frequency in smith

    chart by.

    Figure 18: Double Shunt Stub Matlab GUI

    Figure 19: Solution1 & Solution 2 for double shunt stub

  • 18

    Figure 20: Solution for double shunt stub

  • 19

    4. Conclusion

    For this project, I learned theorically about transmission line, matching network.

    This theoretical information, I learn to make advantage of the programs for

    implementation. The end of project design a GUI-based tool to simulate in frequency

    domain the input impedance of arbitrary series and parallel connection of transmission

    lines and simple passive lumped components with in a user-defined frequency range. The

    input impedance to should also be capable of synthesizing a matching network to

    transform the input impedance level. Among the problems that can be solved by the

    toolbox are no matching network case, the single stub and double stub problems. For these

    problems, the stubs could be either open or short, but they must be in the shunt

    configuration. The toolbox can be solving these problems either analytically or graphically.

    The analytical method implements the design equations in the form of a single Matlab

    command, while the graphical method completes the design process interactively on The

    Smith Chart. The analytical method provides an exact solution to the problem and can

    readily be embedded in a larger design program. When used as a graphical tool, the

    toolbox is particularly valuable to those interested in learning more about transmission line

    applications through visualization. A result of working code completed the goal.

  • 20

    APPENDIX A

  • 21

    APPENDIX B

    Matlab M-file Coding(Matlab 2010 b)

    function varargout=sonhal(varargin)

    close all; clear all; clc;

    fh = figure('Visible','on','Name','Transmission Line Tools',... 'MenuBar','none',....

    'Color',[0.4 0.4 0.5],... 'Position', [520 383 839 417]); ph= uipanel('Parent',fh,'Title','Transmission Line Parameters',... Transmission Line

    parameters 'Units','pixels',....

    'Position',[0 241 170 157]); sth=uicontrol(ph,'Style','text',... Zo yzeyine static text kutusu 'Units','pixels',....

    'String','Zo',.... 'Position',[3 121 52 14]);

    eth0=uicontrol(ph,'Style','edit',... Zo yzeyine edit kutusu ekleme 'Units','pixels',.... 'BackgroundColor',[1 1 1], ...

    'String','50',... 'Position',[59 111 51 22]);

    sth0=uicontrol(ph,'Style','text',... Zo yzeyine static text kutusu 'Units','pixels',... 'String','ohm',...

    'Position',[112 110 52 16]); sth1=uicontrol(ph,'Style','text',... alpha yzeyine static text kutusu

    'Units','pixels',.... 'String','alpha',... 'Position',[3 88 52 14]);

    eth1=uicontrol(ph,'Style','edit',... alpha yzeyine edit kutusu ekleme 'Units','pixels',...

    'BackgroundColor',[1 1 1], ... 'String','0.0002',... 'Position',[59 78 51 22]);

    sth11=uicontrol(ph,'Style','text',...alpha yzeyine static text kutusu 'Units','pixels',...

    'String','dB/m',... 'Position',[119 83 41 14]);

  • 22

    sth69=uicontrol(fh,'Style','text',...C GUI yzeyine static text kutusu

    'Units','pixels',... 'String','Saliha Kaykun eee|student|istanbul|2011',...

    'BackgroundColor',[0.4 0.4 0.5],... 'Position',[36 6 198 32]); sth2=uicontrol(ph,'Style','text',...lenght yzeyine static text kutusu

    'Units','pixels',... 'String','Lenght',...

    'Position',[3 55 52 14]); eth2=uicontrol(ph,'Style','edit',... lenght GUI yzeyine edit kutusu ekleme 'Units','pixels',...

    'BackgroundColor',[1 1 1], ... 'String','0.0001',...

    'Position',[59 45 51 22]); sth22=uicontrol(ph,'Style','text',...lenght GUI yzeyine static text kutusu 'Units','pixels',...

    'String','m',... 'Position',[111 47 52 14]);

    sth3=uicontrol(ph,'Style','text',...Vp GUI yzeyine static text kutusu 'Units','pixels',... 'String','Vp/c',...

    'Position',[3 22 52 14 ]); eth3=uicontrol(ph,'Style','edit',... Vp GUI yzeyine edit kutusu ekleme

    'Units','pixels',... 'String','0.6',... 'BackgroundColor',[1 1 1], ...

    'Position',[59 12 51 22]); ph1 = uipanel('Parent',fh,'Title','Load Impedance',... Load Impedance

    'Units','pixels',... 'Position',[170 241 194 157]); bgh = uibuttongroup(ph1,'Title','',... Load Impedance

    'Units','pixels',... 'Position',[3 93 187 43]);

    rbh1 = uicontrol(bgh,'Style','radiobutton','String','Series',...Series 'Units','pixels',... ekleme 'Position',[5 4 87 23]);

    rbh2 = uicontrol(bgh,'Style','radiobutton','String','Parallel',... Paralel 'Units','pixels',... ekleme

    'Position',[95 5 87 24]); sth4=uicontrol(ph1,'Style','text',...C GUI yzeyine static text kutusu 'Units','pixels',...

    'String','C',... 'Position',[3 49 52 14]);

    eth4=uicontrol(ph1,'Style','edit',... C GUI yzeyine edit kutusu ekleme 'Units','pixels',... 'BackgroundColor',[1 1 1], ...

    'String','0.995',... 'Position',[64 40 51 22]);

  • 23

    sth44=uicontrol(ph1,'Style','text',...C GUI yzeyine static text kutusu

    'Units','pixels',... 'String','pF',...

    'Position',[119 42 52 14]); sth5=uicontrol(ph1,'Style','text',...R GUI yzeyine static text kutusu 'Units','pixels',...

    'String','R',... 'Position',[ 4 74 52 14]);

    eth5=uicontrol(ph1,'Style','edit',... R GUI yzeyine edit kutusu ekleme 'Units','pixels',... 'BackgroundColor',[1 1 1], ...

    'String','60',... 'Position',[64 65 51 22]);

    sth55=uicontrol(ph1,'Style','text',...R GUI yzeyine static text kutusu 'Units','pixels',... 'String','ohm',...

    'Position',[119 68 52 14]); sth6=uicontrol(ph1,'Style','text',...L GUI yzeyine static text kutusu

    'Units','pixels',.... 'String','L',... 'Position',[4 24 52 15]);

    eth6=uicontrol(ph1,'Style','edit',... L GUI yzeyine edit kutusu ekleme 'Units','pixels',....

    'BackgroundColor',[1 1 1], ... 'String','0.0004',... 'Position',[64 15 51 22]);

    sth66=uicontrol(ph1,'Style','text',...L GUI yzeyine static text kutusu 'Units','pixels',...

    'String','nH',... 'Position',[119 18 52 14]); ph2 = uipanel('Parent',fh,'Title','Matching Network',... Matching network

    'Units','pixels',... 'Position',[365 241 447 162]);

    bgh2 = uibuttongroup(ph2,'Title','',... 'Units','pixels',... 'Position',[5 87 81 57]);

    rbh3 = uicontrol(bgh2,'Style','radiobutton','String','Yes',...Yes 'Units','pixels',... ekleme

    'Position',[8 8 60 23]); rbh4 = uicontrol(bgh2,'Style','radiobutton','String','No',... No 'Units','pixels',... ekleme

    'Position',[9 30 60 23]); bgh61 = uibuttongroup(ph2,'Title','',...

    'Units','pixels',... 'Position',[94 87 103 59]); rbh31 = uicontrol(bgh61,'Style','radiobutton','String','Single Stub',...Yes

    'Units','pixels',... ekleme 'Position',[9 32 87 23]);

  • 24

    rbh32 = uicontrol(bgh61,'Style','radiobutton','String','Double Stub',... No

    'Units','pixels',... ekleme 'Position',[8 8 87 23]);

    bgh3 = uibuttongroup(ph2,'Title','Single Stub',... Single Stub 'Units','pixels',... 'Position',[201 75 210 81]);

    bgh4= uibuttongroup(bgh3,'Title','',... 'Units','pixels',...

    'Position',[6 10 118 54]); rbh6 = uicontrol(bgh4,'Style','radiobutton','String','Series',...Series 'Units','pixels',... ekleme

    'Position',[6 28 62 23]); rbh7 = uicontrol(bgh4,'Style','radiobutton','String','Parallel',... Paralel

    'Units','pixels',... ekleme 'Position',[6 5 61 23]); bgh5= uibuttongroup(bgh3,'Title','',...

    'Units','pixels',... 'Position',[135 11 66 53]);

    rbh8 = uicontrol(bgh5,'Style','radiobutton','String','Open',...Open 'Units','pixels',... ekleme 'Position',[8 25 53 25]);

    rbh9 = uicontrol(bgh5,'Style','radiobutton','String','Short',... Short 'Units','pixels',... ekleme

    'Position',[9 6 54 24]); bgh79 = uibuttongroup(ph2,'Title','Double Stub',... Double Stub 'Units','pixels',...

    'Position',[4 4 433 82]); bgh52= uibuttongroup(bgh79,'Title','',... Double Stub

    'Units','pixels',... 'Position',[6 10 96 50]); rbh20 = uicontrol(bgh52,'Style','radiobutton','String','Series',...Series

    'Units','pixels',... ekleme 'Position',[3 24 87 23]);

    rbh21 = uicontrol(bgh52,'Style','radiobutton','String','Parallel',... Paralel 'Units','pixels',... ekleme 'Position',[4 2 87 23]);

    bgh28= uibuttongroup(bgh79,'Title','',... 'Units','pixels',...

    'Position',[114 9 77 53]); rbh43 = uicontrol(bgh28,'Style','radiobutton','String','Open',...Open 'Units','pixels',... ekleme

    'Position',[6 28 63 23]); rbh53 = uicontrol(bgh28,'Style','radiobutton','String','Short',... Short

    'Units','pixels',... ekleme 'Position',[6 5 62 24]); sth7=uicontrol(bgh79,'Style','text',... d yzeyine static text kutusu

    'Units','pixels',.... 'String','d',....

  • 25

    'Position',[195 29 35 15]);

    eth7=uicontrol(bgh79,'Style','edit',... d yzeyine edit kutusu ekleme 'Units','pixels',....

    'BackgroundColor',[1 1 1], ... 'String','0.125',... 'Position',[232 24 51 22]);

    sth77=uicontrol(bgh79,'Style','text',... d yzeyine static text kutusu 'Units','pixels',...

    'String','lambda',... 'Position',[288 30 44 14]); bgh35= uibuttongroup(bgh79,'Title','',...

    'Units','pixels',... 'Position',[340 10 80 52]);

    rbh10 = uicontrol(bgh35,'Style','radiobutton','String','Short',...Short 'Units','pixels',... ekleme 'Position',[4 27 61 23]);

    rbh11 = uicontrol(bgh35,'Style','radiobutton','String','Open',... Open 'Units','pixels',... ekleme

    'Position',[6 6 60 23]); ph3= uipanel('Parent',fh,... GUI yzeyine panel ekleme 'Units','pixels',...

    'Position',[0 84 201 144]); sth8=uicontrol(ph3,'Style','text',...fmatches GUI yzeyine static text kutusu

    'Units','pixels',... 'String','fmatches',... 'Position',[19 104 52 14]);

    eth8=uicontrol(ph3,'Style','edit',... fmatches GUI yzeyine edit kutusu ekleme 'Units','pixels',...

    'String','2',... 'BackgroundColor',[1 1 1], ... 'Position',[84 103 51 22]);

    sth88=uicontrol(ph3,'Style','text',...fmatches GUI yzeyine static text kutusu 'Units','pixels',...

    'String','Ghz',... 'Position',[136 105 52 14]); sth9=uicontrol(ph3,'Style','text',...fstart GUI yzeyine static text kutusu

    'Units','pixels',... 'String','fstart',...

    'Position',[17 73 52 14]); eth9=uicontrol(ph3,'Style','edit',... fstart GUI yzeyine edit kutusu ekleme 'Units','pixels',...

    'String','1',... 'BackgroundColor',[1 1 1], ...

    'Position',[84 70 51 22]); sth99=uicontrol(ph3,'Style','text',...fstart GUI yzeyine static text kutusu 'Units','pixels',...

    'String','Ghz',... 'Position',[136 72 52 14]);

  • 26

    sth10=uicontrol(ph3,'Style','text',...fstop GUI yzeyine static text kutusu

    'Units','pixels',... 'String','fstop',...

    'Position',[21 46 52 14]); eth10=uicontrol(ph3,'Style','edit',... fstop GUI yzeyine edit kutusu ekleme 'Units','pixels',....

    'String','3',... 'BackgroundColor',[1 1 1], ...

    'Position',[84 37 51 22]); sth100=uicontrol(ph3,'Style','text',...fstop GUI yzeyine static text kutusu 'Units','pixels',...

    'String','Ghz',... 'Position',[136 38 52 14]);

    sth11=uicontrol(ph3,'Style','text',...#of points GUI yzeyine static text kutusu 'Units','pixels',... 'String','number of points',...

    'Position',[0 9 81 28]); eth11=uicontrol(ph3,'Style','edit',... #of points GUI yzeyine edit kutusu ekleme

    'Units','pixels',.... 'String','11',... 'BackgroundColor',[1 1 1], ...

    'Position',[84 4 51 22]); ah = axes('Parent',fh,... GRAFIK CIZIMI

    'Units','pixels',... 'Position',[337 57 351 160]); pbh1=uicontrol(fh,'Style','pushbutton','String','RUN',... RUN

    'Units','pixels',... ekleme 'Callback',@pbh1_Callback,...

    'Position',[249 6 151 32]); pbh2= uicontrol(fh,'Style','pushbutton','String','EXIT',... EXIT 'Units','pixels',...ekleme

    'Callback',@pbh2_Callback,... 'Position',[600 8 151 30]);

    sth69=uicontrol(fh,'Style','text',...C GUI yzeyine static text kutusu 'Units','pixels',... 'String','Saliha Kaykun eee|student|istanbul|2011',...

    'BackgroundColor',[0.4 0.4 0.5],... 'Position',[36 6 198 32]);

    handle_list=[ph,sth,eth0,sth0,sth1,eth1,sth11,sth2,... eth2,sth22,sth3,eth3,.... ph1,bgh,rbh1,rbh2,sth5,eth5,sth55,sth4,eth4,sth44,sth6,eth6,sth66,...

    ph2,bgh2,rbh4,rbh3,bgh61,rbh31,rbh32,bgh3,bgh4,rbh6,rbh7,bgh5,rbh8,rbh9,... bgh79,bgh52,rbh20,rbh21,bgh28,rbh43,rbh53,sth7,eth7,sth77,bgh35,rbh10,rbh11,...

    ph3,sth8,eth8,sth88,sth9,eth9,sth99,sth10,eth10,sth100,sth11,sth69,eth11,... ah,pbh1,pbh2]; set(handle_list,'units','normalized')

    function smithc figure;

  • 27

    phase=0:0.1:2*pi+0.1;

    for r=0:0.5:2 z = (r/(r+1) + 1/(r+1)*exp(j*phase));

    plot(z,'Linewidth', 1); hold on; end

    max_phase=[0.93 1.57 1.97]; for x=1:3

    k=max_phase(x); phase=-k:0.01:0; x=x*0.5;

    z=((x+1)/x - 1/x*exp(j*phase))*j+1-j; plot(z, 'Linewidth', 1);

    hold on; end for x=-3:-1

    k=max_phase(-1*x); x=x*0.5;

    phase=0:0.01:k; z=((x+1)/x - 1/x*exp(j*phase))*j+1-j; plot(z, 'Linewidth', 1);

    hold on end

    axis('equal'); axis('off'); plot([-1 1],[0 0]);

    hold on; max_phase=[0.85, 0.79, 0.73, 0.69];

    c=1; for r=0.1:0.1:0.4 k=max_phase(c);

    phase=pi-k:0.01:pi+k; z = (r/(r+1) + 1/(r+1)*exp(j*phase));

    plot(z,'b'); c=c+1; hold on;

    end max_phase=[0.2, 0.395, 0.58, 0.76 ];

    min_phase=[0.132, 0.265, 0.395, 0.52 ]; for x=1:4 k=max_phase(x);

    d=min_phase(x); phase=-k:0.002:-d;

    x=x*0.1; z=((x+1)/x - 1/x*exp(j*phase))*j+1-j; plot(z);

    hold on; z=((x+1)/x - 1/x*exp(j*phase))*j+1-j;

  • 28

    z2=real(z)-j*imag(z);

    plot(z2); end

    title('Smith Chart for Znorm=R+jX'); text(0.39, 0.95,'X=1.5'); %Gives the values of circles on the Chart. text(0.02,0.95,'X=1');

    text(-0.59,0.8,'X=0.5'); text(0.39, -0.95,'X=-1.5');

    text(0.02,-0.95,'X=-1'); text(-0.59,-0.8,'X=-0.5'); text(-0.98,0.05,'0');

    text(0.02,0.05,'1'); text(-0.32,0.05,'0.5');

    text(0.42,0.05,'2'); end function pbh1_Callback(Object, eventdata, handle_list)

    Zo=str2double(get(eth0,'string')); alpha=str2double(get(eth1,'string'));

    lenght=str2double(get(eth2,'string')); Vp=str2double(get(eth3,'string')); C=str2double(get(eth4,'string'));

    R=str2double(get(eth5,'string')); L=str2double(get(eth6,'string'));

    fmatches=str2double(get(eth8,'string')); fstart=str2double(get(eth9,'string')); fstop=str2double(get(eth10,'string'));

    numberofpoints=str2double(get(eth11,'string')); d=str2double(get(eth7,'string'));

    Beta1=(2*pi*fmatches*1e9)/(Vp*3e8); fstep=(fstop-fstart)/(numberofpoints-1); f=(fstart:fstep:fstop);

    w2=2*pi*f ; w1=2*pi*fmatches;

    Beta2=(2*pi.*f*1e9)./(Vp*3e8); lambda=(2*pi)/Beta1; gamma=(alpha/8.686)+(j*Beta2);

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%LOAD IMPEDANCE%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%% impedance=get(rbh1,'value');

    switch impedance case 1 %SERIES ZL1=(R+(j*w1*L)+(1/(j*w1*C*1e-3))); %%%matching network var

    ZL2=(R+(j*w2.*L)+(1./(j*w2.*C*1e-3))); %%%matching network yok fprintf('%10.4g+ %10.4fi ZLoad \n',real(ZL1),imag(ZL1)); .........ORNEK SADECE

  • 29

    case 0 %PARALLEL

    ZL1=1/((1/R)+(1/(j*w1*L))+(j*w1*C*1e-3)); %%%matching network yok ZL2=1./(1/R+(1./(j*w2.*L))+(j*w2.*C*1e-3)); %%%matching network yok

    fprintf('%5.4g+ %5.4fi ZLoad \n',real(ZL1),imag(ZL1)); .........ORNEK SADECE end Zin1=Zo*(ZL1+(j*Zo*tan(Beta1*lenght)))/(Zo+j*ZL1*tan(Beta1*lenght)); %matching

    network yok Zin2=Zo*(ZL2+Zo.*tanh(gamma*lenght))./(Zo+(ZL2.*tanh(gamma*lenght)));

    %matching network varsay Yin1=1/Zin1; Yin2=1./Zin2;

    Yo=1./Zo; matching=get(rbh4,'value');

    switch matching % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

    % % % %%%% No MATCHING%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % case 1

    reflection=(Zin2-Zo)./(Zin2+Zo); SWR=(1+abs(reflection))./(1-abs(reflection));

    zL=Zin2./Zo; fprintf('%d reflection(fstart)\n',abs(reflection(fstart))); .........reflection plot(f,abs(reflection),'ro--');

    legend('solution ',0); xlabel('f*1e9');

    ylabel('|\Gamma|'); smithc; for n=1:length(Zin2)

    plot(real(reflection(n)), imag(reflection(n)),'yellow*'); end;

    a=nearest((Zin2(fstart))/Zo); plot(real(reflection(fstart)), imag(reflection(fstart)),'whiteo','Linewidth',6); k=text(real(reflection(fstart))+0.02, imag(reflection(fstart))+0.02, ['zin2=', num2str(a)]);

    k=text(real(reflection(fstart))+0.15, imag(reflection(fstart))+0.15, ['fstart=', num2str(fstart)]);

    set (k, 'BackgroundColor', 'w'); b=nearest((Zin2(n))/Zo); plot(real(reflection(n)), imag(reflection(n)),'blacko','Linewidth',6);

    e=text(real(reflection(n))+0.02, imag(reflection(n))+0.02, ['zin2=', num2str(b)]); e=text(real(reflection(n))+0.15, imag(reflection(n))+0.15, ['fstop=', num2str(fstop)]);

    set (e, 'BackgroundColor', 'w'); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

    % % % %%%%MATCHING NETWORK%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  • 30

    % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

    % % % % % % case 0

    sstub=get(rbh31,'value'); switch sstub case 1

    % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

    % % % %%%%SINGLE STUB%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

    series=get(rbh6,'value'); switch series

    %%%%%%%%%%%%%%%%%%%%%%% % % % % % % % SERIES % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    case 1 GL = real(Yin1);

    BL = imag(Yin1); Zin1=1./Yo; if (GL==Yo),

    t1 = -BL./(2*Yo); t2=t1;

    else t1 = (BL+sqrt(GL.*((Yo-GL).^2+BL.^2)./Yo))./(GL-Yo); t2 = (BL-sqrt(GL.*((Yo-GL).^2+BL.^2)./Yo))./(GL-Yo);

    end if (t1 >= 0),

    D1=lambda./2./pi.*atan(t1); else D1=lambda./2./pi.*(pi+atan(t1));

    end; if (t2 >= 0),

    D2=lambda./2./pi.*atan(t2); else D2=lambda./2./pi.*(pi+atan(t2));

    end; X1 = (GL.^2.*t1-(Yo-BL.*t1).*(BL+Yo.*t1))./(Yo.*(GL.^2+(BL+Yo.*t1).^2));

    X2 = (GL.^2.*t2-(Yo-BL.*t2).*(BL+Yo.*t2))./(Yo.*(GL.^2+(BL+Yo.*t2).^2)); singlestub=get(rbh8,'value'); %%%%% Single stub open short hali switch singlestub

    case 0 %%%sghort L1 =-(lambda./2./pi.*atan(X1./Zin1));

    L2 =-(lambda./2./pi.*atan(X2./Zin1)); case 1 % L1 =lambda./2./pi.*atan(Zin1./X1);

    L2 =lambda./2./pi.*atan(Zin1./X2); end;

  • 31

    if (L1 < 0),

    L1 = L1 + lambda./2; end;

    if (L2 < 0), L2 = L2 + lambda./2; end;

    fprintf('%d d2 Solution 1\n',D2./lambda); fprintf('%d L2 Solution 1 \n',L2./lambda);

    fprintf('%d d1 Solution2 \n',D1./lambda); fprintf('%d L1 Solution 2 \n',L1./lambda); Ztline1=(Yo+(j*Yin2.*tan(Beta2.*D1)))./(Yo.*(Yin2+(j*Yo.*tan(Beta2.*D1))));

    Ztline2=(Yo+(j*Yin2.*tan(Beta2.*D2)))./(Yo.*(Yin2+(j*Yo.*tan(Beta2.*D2)))); switch singlestub

    case 1 %%%Short Zstub1=(-(j*cot(Beta2.*L1))./Yo); Zstub2=(-(j*cot(Beta2.*L2))./Yo);

    case 0 %%%open Zstub1=(j*tan(Beta2.*L1)./Yo);

    Zstub2=(j*tan(Beta2.*L2)./Yo); end; Z1=Ztline1+Zstub1;

    Z2=Ztline2+Zstub2; reflection3=(Z1-Zo)./(Z1+Zo);

    reflection4=(Z2-Zo)./(Z2+Zo); SWR3=(1+abs(reflection3))./(1-abs(reflection3)); SWR4=(1+abs(reflection4))./(1-abs(reflection4));

    plot(f,abs(reflection3),'k*:',f,abs(reflection4),'rs--'); % fprintf('%5.4g+ i%5.4f Z1\n',real(Z1),imag(Z1)); .........ORNEK SADECE

    % fprintf('%5.4g+ i%5.4f Z2\n',real(Z2),imag(Z2)); .........ORNEK SADECE xlabel('f*1e9'); ylabel('|\Gamma|');

    legend('solution 1','solution 2',0); %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%

    % % % % % % % Smith Chart ta Gosterimi %%%%%%%%%%%%%%%%%%%%%%% % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    smithc; for n=1:length(Z1)

    plot(real(reflection3(n)), imag(reflection3(n)),'yellow*'); end; a=nearest((Z1(fstart))/Zo);

    plot(real(reflection3(fstart)), imag(reflection3(fstart)),'whiteo','Linewidth',6); k=text(real(reflection3(fstart))+0.02, imag(reflection3(fstart))+0.02, ['zin2=',

    num2str(a)]); k=text(real(reflection3(fstart))+0.15, imag(reflection3(fstart))+0.15, ['fstart=', num2str(fstart)]);

    set (k, 'BackgroundColor', 'w'); b=nearest((Z1(n))/Zo);

  • 32

    plot(real(reflection3(n)), imag(reflection3(n)),'black*','Linewidth',6);

    e=text(real(reflection3(n))+0.02, imag(reflection3(n))+0.02, ['zin2=', num2str(b)]); e=text(real(reflection3(n))+0.15, imag(reflection3(n))+0.15, ['fstop=', num2str(fstop)]);

    set (e, 'BackgroundColor', 'w'); smithc; for n=1:length(Z2)

    plot(real(reflection4(n)), imag(reflection4(n)),'yellow*'); end;

    t=nearest((Z2(fstart))/Zo); plot(real(reflection4(fstart)), imag(reflection4(fstart)),'whiteo','Linewidth',6); g=text(real(reflection4(fstart))+0.02, imag(reflection4(fstart))+0.02, ['zin2=',

    num2str(t)]); g=text(real(reflection4(fstart))+0.15, imag(reflection4(fstart))+0.15, ['fstart=',

    num2str(fstart)]); set (g, 'BackgroundColor', 'w'); b=nearest((Z2(n))/Zo);

    plot(real(reflection4(n)), imag(reflection4(n)),'black*','Linewidth',6); o=text(real(reflection4(n))+0.06, imag(reflection4(n))+0.06, ['zin2=', num2str(b)]);

    o=text(real(reflection4(n))+0.15, imag(reflection4(n))+0.15, ['fstop=', num2str(fstop)]); set (o, 'BackgroundColor', 'w'); %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%

    % % % % % % % PARALLEL %%%%%%%%%%%%%%%%%%%%%%% % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    case 0 %Parallel RL = real(Zin1); XL = imag(Zin1);

    Yin1=1./Zo; if (RL== Zo),

    t1 = -XL./(2*Zo); t2=t1; else

    t1 = (XL+sqrt(RL.*((Zo-RL).^2+XL.^2)./Zo))./(RL-Zo); t2 = (XL-sqrt(RL.*((Zo-RL).^2+XL.^2)./Zo))./(RL-Zo);

    end; if (t1 >= 0), D1 = lambda./2./pi.*atan(t1);

    else D1 =lambda./2./pi.*(pi+atan(t1));

    end; if (t2 >= 0), D2 = lambda./2./pi.*atan(t2);

    else D2 = lambda./2./pi.*(pi+atan(t2));

    end; B1 = (RL.^2.*t1-(Zo-XL.*t1).*(XL+Zo.*t1))./(Zo.*(RL.^2+(XL+Zo.*t1).^2)); B2 = (RL.^2.*t2-(Zo-XL.*t2).*(XL+Zo.*t2))./(Zo.*(RL.^2+(XL+Zo.*t2).^2));

    % fprintf('%d X1\n',B1); % fprintf('%d X2\n',B2);

  • 33

    singlestub=get(rbh8,'value'); %%%%%%Single stub open short hali

    switch singlestub case 1 %%%Open

    L1 = -lambda./2./pi.*atan(B1./Yin1); L2 = -lambda./2./pi.*atan(B2./Yin1); case 0 %%%short

    L1 = lambda./2./pi.*atan(Yin1./B1); L2 = lambda./2./pi.*atan(Yin1./B2);

    end; if (L1 < 0), L1 = L1 + lambda./2;

    end; if (L2 < 0),

    L2 = L2 + lambda./2; end; fprintf('%d d1 Solution1 \n',D1./lambda);

    fprintf('%d L1 Solution 1 \n',L1./lambda); fprintf('%d d2 Solution 2\n',D2./lambda);

    fprintf('%d L2 Solution 2 \n',L2./lambda); Ytline1=(Zo+(j*Zin2.*tan(Beta2.*D1)))./(Zo.*(Zin2+j*Zo.*tan(Beta2.*D1))); Ytline2=(Zo+(j*Zin2.*tan(Beta2.*D2)))./(Zo.*(Zin2+j*Zo.*tan(Beta2.*D2)));

    switch singlestub case 1 %%%Open

    Ystub1=(j*tan(Beta2.*L1))./Zo; Ystub2=(j*tan(Beta2.*L2))./Zo; case 0 %%%short

    Ystub1=1./(j*tan(Beta2.*L1)*Zo); Ystub2=1./(j*tan(Beta2.*L2)*Zo);

    end; Z1=Ytline1+Ystub1; Z2=Ytline2+Ystub2;

    Y1=1./Z1; Y2=1./Z2;

    reflection1=(Y1-Zo)./(Y1+Zo); reflection2=(Y2-Zo)./(Y2+Zo); SWR1=(1+abs(reflection1))./(1-abs(reflection1));

    SWR2=(1+abs(reflection2))./(1-abs(reflection2)); plot(f,abs(reflection1),'k*:',f,abs(reflection2),'rs--');

    xlabel('f*1e9'); ylabel('|\Gamma|'); legend('solution 1','solution 2',0);

    %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% % % % % % % % Smith Chart ta Gosterimi

    %%%%%%%%%%%%%%%%%%%%%%% % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% smithc;

    for n=1:length(Y1) plot(real(reflection1(n)), imag(reflection1(n)),'yellow*');

  • 34

    end;

    a=nearest((Y1(fstart))/Zo); plot(real(reflection1(fstart)), imag(reflection1(fstart)),'whiteo','Linewidth',6);

    k=text(real(reflection1(fstart))+0.02, imag(reflection1(fstart))+0.02, ['zin2=', num2str(a)]); k=text(real(reflection1(fstart))+0.15, imag(reflection1(fstart))+0.15, ['fstart=',

    num2str(fstart)]); set (k, 'BackgroundColor', 'w');

    b=nearest((Y1(n))/Zo); plot(real(reflection1(n)), imag(reflection1(n)),'black*','Linewidth',6); e=text(real(reflection1(n))+0.02, imag(reflection1(n))+0.02, ['zin2=', num2str(b)]);

    e=text(real(reflection1(n))+0.15, imag(reflection1(n))+0.15, ['fstop=', num2str(fstop)]); set (e, 'BackgroundColor', 'w');

    smithc; for n=1:length(Y2) plot(real(reflection2(n)), imag(reflection2(n)),'yellow*');

    end; t=nearest((Y2(fstart))/Zo);

    plot(real(reflection2(fstart)), imag(reflection2(fstart)),'whiteo','Linewidth',6); g=text(real(reflection2(fstart))+0.02, imag(reflection2(fstart))+0.02, ['zin2=', num2str(t)]);

    g=text(real(reflection2(fstart))+0.15, imag(reflection2(fstart))+0.15, ['fstart=', num2str(fstart)]);

    set (g, 'BackgroundColor', 'w'); b=nearest((Y2(n))/Zo); plot(real(reflection2(n)), imag(reflection2(n)),'black*','Linewidth',6);

    o=text(real(reflection2(n))+0.06, imag(reflection2(n))+0.06, ['zin2=', num2str(b)]); o=text(real(reflection2(n))+0.15, imag(reflection2(n))+0.15, ['fstop=', num2str(fstop)]);

    set (o, 'BackgroundColor', 'w'); end % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

    % % % % % % % % %%%%Double STUB%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % case 0

    dstub=get(rbh20,'value'); %%%Double Stub %SERIES switch dstub

    case 1 %SERIES zL = Zin1/Zo; yL = 1/zL;

    rL = real(zL); xL = imag(zL);

    t = tan(2*pi*d); b = sqrt(rL*(1+t^2)-rL^2*t^2); X1 = -xL + ((1 + b)/t);

    X11 = -xL + ((1-b)/t); X2 = (b + rL)/(rL*t);

  • 35

    X22 = (-b + rL)/(rL*t);

    open=get(rbh43,'value'); %%%Double Stub switch open

    case 1 %D1 OPEN d1 = atan(1./X1)/(2*pi) ; d2 = atan(1./X11)/(2*pi) ;

    if (d2 < 0), d2 = d2 + 1/2;

    end; if (d1 < 0), d1 = d1 + 1/2;

    end; Zstub1=j*tan(Beta1*d1*lambda);

    Zstub11=j*tan(Beta1*d2*lambda); Z1=zL+Zstub1; Z11=zL+Zstub11;

    open2=get(rbh11,'value'); %%%Double Stub switch open2

    case 1 %D2 OPEN d11 = atan(1./X2)/(2*pi) ; d22= atan(1./X22)/(2*pi) ;

    if (d22 < 0), d22= d22 + 1/2;

    end; if (d11 < 0), d11= d11+ 1/2;

    end; Z2=(Z1+j*tan(Beta1*d*lambda))/(1+j*Z1*tan(Beta1*d*lambda));

    Z22=(Z11+j*tan(Beta1*d*lambda))/(1+j*Z11*tan(Beta1*d*lambda)); ZA1 = Z2+j*tan(Beta2.*d11*lambda); ZA11 = Z22+j*tan(Beta2.*d22*lambda);

    case 0 % D2 SHORT d11 =atan(X2)./(2*pi) ;

    d22 =atan(X22)./(2*pi) ; if (d22 < 0), d22= d22 + 1/2;

    end if (d11< 0),

    d11= d11 + 1/2; end Z2=(Z1+j*tan(Beta1*d*lambda))/(1+j*Z1*tan(Beta1*d*lambda));

    Z22=(Z11+j*tan(Beta1*d*lambda))/(1+j*Z11*tan(Beta1*d*lambda)); ZA1 = Z2-j*cot(Beta2.*d11*lambda);

    ZA11 = Z22 -j*cot(Beta2.*d22*lambda); end case 0 % D1 SHORT

    d1 = atan(X1)/(2*pi) ; d2=atan(X11)/(2*pi) ;

  • 36

    if (d2 < 0),

    d2 = d2 + 1/2; end;

    if (d1 < 0), d1 = d1 + 1/2; end;

    if (d2 < 0), d2 = d2 + 1/2;

    end; Zstub1=-j*cot(Beta1*d1*lambda); Zstub11=-j*cot(Beta1*d2*lambda);

    Z1=zL+Zstub1; Z11=zL+Zstub11;

    open2=get(rbh11,'value'); %%%Double Stub switch open2 case 1 %D2 OPEN

    d11 = atan(1./X2)/(2*pi) ; d22=atan(1./X22)/(2*pi) ;

    if (d22 < 0), d22= d22 + 1/2; end;

    if (d11 < 0), d11= d11 + 1/2;

    end; Z2=(Z1+j*tan(Beta1*d*lambda))/(1+j*Z1*tan(Beta1*d*lambda)); Z22=(Z11+j*tan(Beta1*d*lambda))/(1+j*Z11*tan(Beta1*d*lambda));

    ZA1 = Z2+j*tan(Beta2.*d11*lambda); ZA11 = Z22+j*tan(Beta2.*d22*lambda);

    case 0 % D2 Short d11 =atan(X2)./(2*pi) ; d22 =atan(X22)./(2*pi) ;

    if (d22 < 0), d22= d22 + 1/2;

    end; if (d11 < 0), d11= d11 + 1/2;

    end; Z2=(Z1+j*tan(Beta1*d*lambda))/(1+j*Z1*tan(Beta1*d*lambda));

    Z22=(Z11+j*tan(Beta1*d*lambda))/(1+j*Z11*tan(Beta1*d*lambda)); ZA1 = Z2-j*cot(Beta2.*d11*lambda); ZA11 = Z22-j*cot(Beta2.*d22*lambda);

    end end

    fprintf('%d d1Solution 1 \n',d1); fprintf('%dd11 Solution 1 \n',d11); fprintf('%d d2 Solution 2\n',d2);

    fprintf('%d d22 Solution 2 \n',d22); YA1=1./ZA1;

  • 37

    YA11=1./ZA11;

    reflection1=(YA1-Zo)./(YA1+Zo); reflection2=(YA11-Zo)./(YA11+Zo);

    SWR1=(1+abs(reflection1))./(1-abs(reflection1)); SWR2=(1+abs(reflection2))./(1-abs(reflection2)); plot(f,abs(reflection1),'k*:',f,abs(reflection2),'rs--');

    xlabel('f*1e9'); ylabel('|\Gamma|');

    legend('solution 1','solution 2',0); %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% % % % % % % % Smith Chart ta Gosterimi

    %%%%%%%%%%%%%%%%%%%%%%% % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%

    smithc; for n=1:length(YA1) plot(real(reflection1(n)), imag(reflection1(n)),'yellow*');

    end; a=nearest((YA1(fstart))/Zo);

    plot(real(reflection1(fstart)), imag(reflection1(fstart)),'whiteo','Linewidth',6); k=text(real(reflection1(fstart))+0.02, imag(reflection1(fstart))+0.02, ['zin2=', num2str(a)]);

    k=text(real(reflection1(fstart))+0.15, imag(reflection1(fstart))+0.15, ['fstart=', num2str(fstart)]);

    set (k, 'BackgroundColor', 'w'); b=nearest((YA1(n))/Zo); plot(real(reflection1(n)), imag(reflection1(n)),'black*','Linewidth',6);

    e=text(real(reflection1(n))+0.02, imag(reflection1(n))+0.02, ['zin2=', num2str(b)]); e=text(real(reflection1(n))+0.15, imag(reflection1(n))+0.15, ['fstop=', num2str(fstop)]);

    set (e, 'BackgroundColor', 'w'); zoom; smithc;

    for n=1:length(YA11) plot(real(reflection2(n)), imag(reflection2(n)),'yellow*');

    end; t=nearest((YA11(fstart))/Zo); plot(real(reflection2(fstart)), imag(reflection2(fstart)),'whiteo','Linewidth',6);

    g=text(real(reflection2(fstart))+0.02, imag(reflection2(fstart))+0.02, ['zin2=', num2str(t)]);

    g=text(real(reflection2(fstart))+0.15, imag(reflection2(fstart))+0.15, ['fstart=', num2str(fstart)]); set (g, 'BackgroundColor', 'w');

    b=nearest((YA11(n))/Zo); plot(real(reflection2(n)), imag(reflection2(n)),'black*','Linewidth',6);

    o=text(real(reflection2(n))+0.06, imag(reflection2(n))+0.06, ['zin2=', num2str(b)]); o=text(real(reflection2(n))+0.15, imag(reflection2(n))+0.15, ['fstop=', num2str(fstop)]); set (o, 'BackgroundColor', 'w');

    zoom; %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%

  • 38

    % % % % % % % PARALLEL %%%%%%%%%%%%%%%%%%%%%%%

    % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% case 0

    zL = Zin1/Zo; yL = 1/zL; gL = real(yL);

    bL = imag(yL); t = tan(2*pi*d);

    b = sqrt(gL*(1+t^2)-gL^2*t^2); B1 = -bL + ((1 + b)/t); B11 = -bL + ((1-b)/t);

    B2 = (b + gL)/(gL*t); B22 = (-b + gL)/(gL*t);

    open=get(rbh43,'value'); %%%Double Stub switch open case 1 %D1 OPEN

    d1 = atan(B1)/(2*pi) ; d2 = atan(B11)/(2*pi) ;

    if (d2 < 0), d2 = d2 + 1/2; end;

    if (d1 < 0), d1 = d1 + 1/2;

    end; Ystub1=j*tan(Beta1*d1*lambda); Ystub11=j*tan(Beta1*d2*lambda);

    Y1=yL+Ystub1; Y11=yL+Ystub11;

    open2=get(rbh11,'value'); %%%Double Stub switch open2 case 1 %D2 OPEN

    d11 = atan(B2)/(2*pi) ; d22= atan(B22)/(2*pi) ;

    if (d22 < 0), d22= d22 + 1/2; end;

    if (d11 < 0), d11= d11 + 1/2;

    end Y2=(Y1+j*tan(Beta1*d*lambda))/(1+j*Y1*tan(Beta1*d*lambda)); Y22=(Y11+j*tan(Beta1*d*lambda))/(1+j*Y11*tan(Beta1*d*lambda));

    YA1 = Y2+j*tan(Beta2.*d11*lambda); YA11 = Y22+j*tan(Beta2.*d22*lambda);

    case 0 % D2 SHORT d11 =-atan(1./B2)./(2*pi) ; d22 =-atan(1./B22)./(2*pi) ;

    if (d22 < 0), d22= d22 + 1/2;

  • 39

    end

    if (d11 < 0), d11= d11 + 1/2;

    end Y2=(Y1+j*tan(Beta1*d*lambda))/(1+j*Y1*tan(Beta1*d*lambda)); Y22=(Y11+j*tan(Beta1*d*lambda))/(1+j*Y11*tan(Beta1*d*lambda));

    YA1 = Y2-j*cot(Beta2.*d11*lambda); YA11 = Y22 -j*cot(Beta2.*d22*lambda);

    end case 0 % D1 SHORT d1 = -atan(1./B1)./(2*pi) ;

    d2 =-atan(1./B11)./(2*pi) ; if (d2 < 0),

    d2 = d2 + 1/2; end; if (d1 < 0),

    d1 = d1 + 1/2; end;

    Ystub1=-j*cot(Beta1*d1*lambda); Ystub2=-j*cot(Beta1*d2*lambda); Y1=yL+Ystub1;

    Y11=yL+Ystub2; open2=get(rbh11,'value'); %%%Double Stub

    switch open2 case 1 %D2 OPEN d11 = atan(B2)./(2*pi) ;

    d22= atan(B22)./(2*pi) ; if (d22 < 0),

    d22= d22 + 1/2; end; if (d11 < 0),

    d11= d11 + 1/2; end;

    Y2=(Y1+j*tan(Beta1*d*lambda))/(1+j*Y1*tan(Beta1*d*lambda)); Y22=(Y11+j*tan(Beta1*d*lambda))/(1+j*Y11*tan(Beta1*d*lambda)); YA1 = Y2+j*tan(Beta2.*d11*lambda);

    YA11 = Y22+j*tan(Beta2.*d22*lambda); case 0 % D2 Short

    d11 =-atan(1./B2)./(2*pi) ; d22 =-atan(1./B22)./(2*pi) ; if (d22 < 0),

    d22= d22 + 1/2; end;

    if (d11 < 0), d11= d11 + 1/2; end;

    Y2=(Y1+j*tan(Beta1*d*lambda))/(1+j*Y1*tan(Beta1*d*lambda)); Y22=(Y11+j*tan(Beta1*d*lambda))/(1+j*Y11*tan(Beta1*d*lambda));

  • 40

    YA1 = Y2-j*cot(Beta2.*d11*lambda);

    YA11 = Y22-j*cot(Beta2.*d22*lambda); end

    end fprintf('%d d1Solution 1 \n',d1); fprintf('%dd11 Solution 1 \n',d11);

    fprintf('%d d2 Solution 2\n',d2); fprintf('%d d22 Solution 2 \n',d22);

    ZA1=1./YA1; ZA11=1./YA11; reflection1=(ZA1-Zo)./(ZA1+Zo);

    reflection2=(ZA11-Zo)./(ZA11+Zo); SWR1=(1+abs(reflection1))./(1-abs(reflection1));

    SWR2=(1+abs(reflection2))./(1-abs(reflection2)); plot(f,abs(reflection1),'k*:',f,abs(reflection2),'rs--'); xlabel('f*1e9');

    ylabel('|\Gamma|'); legend('solution 1','solution 2',0);

    %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% % % % % % % % PARALLELin SONU %%%%%%%%%%%%%%%%%%%%%%%

    % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% smithc;

    for n=1:length(ZA1) plot(real(reflection1(n)), imag(reflection1(n)),'yellow*'); end;

    a=nearest((ZA1(fstart))/Zo); plot(real(reflection1(fstart)), imag(reflection1(fstart)),'whiteo','Linewidth',6);

    k=text(real(reflection1(fstart))+0.02, imag(reflection1(fstart))+0.02, ['zin2=', num2str(a)]); k=text(real(reflection1(fstart))+0.15, imag(reflection1(fstart))+0.15, ['fstart=',

    num2str(fstart)]); set (k, 'BackgroundColor', 'w');

    b=nearest((ZA1(n))/Zo); plot(real(reflection1(n)), imag(reflection1(n)),'black*','Linewidth',6); e=text(real(reflection1(n))+0.02, imag(reflection1(n))+0.02, ['zin2=', num2str(b)]);

    e=text(real(reflection1(n))+0.15, imag(reflection1(n))+0.15, ['fstop=', num2str(fstop)]); set (e, 'BackgroundColor', 'w');

    zoom; smithc; for n=1:length(ZA11)

    plot(real(reflection2(n)), imag(reflection2(n)),'yellow*'); end;

    t=nearest((ZA11(fstart))/Zo); plot(real(reflection2(fstart)), imag(reflection2(fstart)),'whiteo','Linewidth',6); g=text(real(reflection2(fstart))+0.02, imag(reflection2(fstart))+0.02, ['zin2=',

    num2str(t)]);

  • 41

    g=text(real(reflection2(fstart))+0.15, imag(reflection2(fstart))+0.15, ['fstart=',

    num2str(fstart)]); set (g, 'BackgroundColor', 'w');

    b=nearest((ZA11(n))/Zo); plot(real(reflection2(n)), imag(reflection2(n)),'black*','Linewidth',6); o=text(real(reflection2(n))+0.06, imag(reflection2(n))+0.06, ['zin2=', num2str(b)]);

    o=text(real(reflection2(n))+0.15, imag(reflection2(n))+0.15, ['fstop=', num2str(fstop)]); set (o, 'BackgroundColor', 'w');

    zoom; end %Double Stub n endi end %%Matching end i

    %%%%% %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% % % % % % % % Smith Chart %%%%%%%%%%%%%%%%%%%%%%%

    % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% end end

    function pbh2_Callback(Object, eventdata, handle_list) close(fh);

    clc; clear all; close all;

    end end

  • 42

  • 43

    REFERENCES

    1. Introduction to wave propagation, transmission lines and antennas, NAVAL

    EDUCATION AND TRAINING PROFESSIONAL DEVELOPMENT AND

    TECHNOLOGY CENTER CONTENTS, 1998

    2. http://en.wikipedia.org/wiki/Reflection_coefficient(27.05.2011)

    3. Fundamentals of Engineering Electromagnetics, Rajeev Bansal , 2006

    4. Microwave Engineering ,David M. Pozar, third edition,2005

    5. Graphics and GUIs with MATLAB, Patrick Marchand and O. Thomas,third

    edition,2003