微波实验报告 smith原图 matlab
更新时间:2024-07-09 11:29:01 阅读量: 综合文库 文档下载
- 微波实验报告实验总结推荐度:
- 相关推荐
微波通信技术课程设计报告
Smith圆图软件
一:Smith圆图简要说明
用户输入阻抗实部与虚部在对应位置,以及特性阻抗。软件通过程序计算出导纳值、反射系数、相位、波长、驻波比、行波系数以及如何实现匹配,并显示在对应位置,其中实现匹配的方法显示在软件下方蓝色区域内;点击清楚图像可清楚归一化电阻圆、归一化电抗圆以及等反射系数圆;取点画图可在图像区域内根据鼠标确定点画出对应的归一化电阻圆等,以及显示导纳值等相关数据。单枝节匹配和双枝节匹配可根据输入的阻抗值和特性阻抗画出匹配图并标明对应点,其中单枝节匹配还可在下方显示出来具体的匹配方案。以上是该smith原图所有的功能。
二:Smith圆图的设计目的和要求
设计目的:
通过具体的软件编程和多媒体制作,进一步加深对微波通信技术的理解
和掌握,提高动手能力,提高解决实际问题的综合能力。 设计要求:
整个圆图软件分为用户图形界面模块、圆图计算模块、画图演示模块。上述: 大模块又进一步分解,其中用户图形界面模块分为:主页、主菜单;圆图计算模块分为反射系数计算、单支节匹配计算、输入阻抗计算以及整个Smith圆图;画图演示模块分为等归一化电阻圆、等归一化电抗圆、反射系数圆等;确定阻抗值在圆图上的位置、圆图的基本应用、求输入阻抗及其在圆图上的位置以及单支节匹配等问题。
三:Smith圆图的程序流程图
清除图像可根据需要在画图步骤后执行,清楚图像值清楚归一化电阻圆、归一化电抗圆等,并不清楚圆图的基本构架图
四:演示验证过程
输入阻抗和特性阻抗点击确定图:
点击清除图像后的图:
点击单枝节匹配图:
点击双枝节匹配图:
点击取点画图:
五:总结
1.心得体会:这次课设收获最多的觉得是matlab guide图像交互界面的使用与设计。这次程序的设计,明白了guide里面控件string、tag的重要性。在这次设计中,在网上找了两个程序做辅导,因为网上的资料并不需要figure就能成功运行,编程的方法不一样,所以通过自己各种查找资料(包括百度知道、百度文库、以及matlab技术论坛电子期刊等、)学习了guide的重要语句的使用,包括handles语句、str2double语句、set语句、delete语句的使用,明白了这几个基础语句的使用,在加上smith原理算法,从而成功的用自己的方法实现了smith原图的功能。
2.源程序:
function varargout = liujiaqingnew(varargin)
% LIUJIAQINGNEW MATLAB code for liujiaqingnew.fig
% LIUJIAQINGNEW, by itself, creates a new LIUJIAQINGNEW or raises the existing % singleton*.
%
% H = LIUJIAQINGNEW returns the handle to a new LIUJIAQINGNEW or the handle to
% the existing singleton*. %
% LIUJIAQINGNEW('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LIUJIAQINGNEW.M with the given input arguments. %
% LIUJIAQINGNEW('Property','Value',...) creates a new LIUJIAQINGNEW or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before liujiaqingnew_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to liujiaqingnew_OpeningFcn via varargin. %
% *See GUI Options on GUIDE's Tools menu. Choose \only one
% instance to run (singleton)\ %
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help liujiaqingnew
% Last Modified by GUIDE v2.5 07-Jun-2013 00:23:26
% Begin initialization code - DO NOT EDIT gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @liujiaqingnew_OpeningFcn, ...
'gui_OutputFcn', @liujiaqingnew_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 liujiaqingnew is made visible.
function liujiaqingnew_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 liujiaqingnew (see VARARGIN)
% Choose default command line output for liujiaqingnew handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes liujiaqingnew wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = liujiaqingnew_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;
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) %handles(axes1);
for R0=[0 0.2 0.5 1 2 ];
for X0=[-4 -2 -1 -0.5 -0.3 0.3 0.5 1 2 4];%循环输入归一化阻抗 tr=2*pi*(0:0.005:1); rr=1/(1+R0);cr=1-rr;
plot(cr+rr*cos(tr),rr*sin(tr),'g');%画电阻圆 axis square; hold on; x=X0;
rx=1/x;cx=rx;
tx=2*atan(x)*(0:0.01:1); if tx plot(1-rx*sin(tx),cx-rx*cos(tx),'g')%画电抗圆 else plot(1-rx*sin(tx),-cx-rx*cos(tx),'g') end hold on; end end t=-1:0.001:1;%画横轴 plot(t,0,'g'); axis square; hold on; R0= get(handles.R ,'string');%提取电阻电抗值 X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string'); R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo); %归一化 R=R0/Zo; X=X0/Zo; %画smith图 U=(R^2+X^2-1)/(R^2+2*R+1+X^2);%转化为坐标值 即U V V=2*X/(R^2+2*R+1+X^2); tr=2*pi*(0:0.00001:1); cosA=U/sqrt(U^2+V^2);%画相角线 sinA=V/sqrt(U^2+V^2); r0=0:0.00001:1; g0=plot(r0*cosA,r0*sinA,'k','linewidth',1.5); axis square; hold on; rr=1/(1+R);cr=1-rr; g1=plot(cr+rr*cos(tr),rr*sin(tr),'r','linewidth',1.5);%画电阻圆 axis square; hold on; x=X; rx=1/x;cx=rx; tx=2*atan(x)*(0:0.0001:1); if tx g2=plot(1-rx*sin(tx),cx-rx*cos(tx),'m','linewidth',1.5);%画电抗圆 else g3=plot(1-rx*sin(tx),-cx-rx*cos(tx),'m','linewidth',1.5); end hold on; r=sqrt(U^2+V^2); g4=plot(r*cos(tr),r*sin(tr),'--','linewidth',1.5);% 等反射系数圆的半径 axis square; hold on; G=R/(R^2+X^2);%导纳 B=-X/(R^2+X^2); U=(R^2+X^2-1)/(R^2+2*R+1+X^2);%反射系数 V=2*X/(R^2+2*R+1+X^2); zhu_bo_bi=(1+sqrt(U^2+V^2))/(1-sqrt(U^2+V^2));%驻波比 xing_bo_xi_shu=1/zhu_bo_bi; %行波系数 A0=atan(V/U); %相位角 if U<0 A=(180/pi)*(A0+pi); elseif V>=0 A=(180/pi)*A0; else A=(180/pi)*(A0+2*pi); end if V>=0 L=(0.5/360)*(180-A); else L=0.75-(0.5/360)*A; end %波长数 %匹配问题 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% z=R+j*X; Gamma2=(z-1)/(z+1); Mod=abs(Gamma2); Phi=angle(Gamma2); if X0<0 if(Phi>=0) Lmin=Phi/(4*pi); Lmax=0.25+Lmin; else Lmin=(pi+Phi)/(4*pi); Lmax=0.25+Lmin; end else if(Phi>=0) Lmax=Phi/(4*pi); Lmin=0.25+Lmax; else Lmax=(pi+Phi)/(4*pi); Lmin=0.25+Lmax; end hold off; end rho=(1+abs(Gamma2))/(1-abs(Gamma2)); Zo1=Zo*sqrt(rho); Zo2=Zo/sqrt(rho); set(handles.Ht5,'string',strcat('在L1=',num2str(Lmax),'λ处并接入特性阻抗为 Zo1 = ', num2str(Zo1),' Ω 的λ/4传输线可实现匹配'),'fontname','宋体','fontsize',12); set(handles.Ht6,'string',strcat('或在L2=',num2str(Lmin),'λ处并接入特性阻抗为 Zo2 = ', num2str(Zo2),' Ω 的λ/4传输线可实现匹配'),'fontname','宋体','fontsize',12); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %显示各种参数值 G = num2str(G); % 转换为字符串 set(handles.G,'string',G); B = num2str(B); % 转换为字符串 set(handles.B,'string',B); zhu_bo_bi= num2str(zhu_bo_bi); % 转换为字符串 set(handles.zhu_bo_bi,'string',zhu_bo_bi); xing_bo_xi_shu = num2str(xing_bo_xi_shu); % 转换为字符串 set(handles.xing_bo_xi_shu,'string',xing_bo_xi_shu); U = num2str(U); % 转换为字符串 set(handles.U,'string',U); V = num2str(V); % 转换为字符串 set(handles.V,'string',V); xw = num2str(A); % 转换为字符串 set(handles.xw,'string',xw); bc= num2str(L); % 转换为字符串 set(handles.bc,'string',bc); guidata(hObject, handles); % 更新结构体 function X_Callback(hObject, eventdata, handles) % hObject handle to X (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) X= str2double(get(hObject,'String')); % string属性是字符串,所以必须转换成数值 % 检验输入是否为空,是则将它置为0 if (isempty(X)) set(hObject,'String','0') end % 保存handles结构体,只要在handles结构体有改变时,才需要保存 guidata(hObject, handles); % 这里由于handles没有改变,故这里其实没有必要,但是为了避免潜在的不必要麻烦, % 建议在所有Callback最后都添加该命令 % Hints: get(hObject,'String') returns contents of X as text % str2double(get(hObject,'String')) returns contents of X as a double % --- Executes during object creation, after setting all properties. function X_CreateFcn(hObject, eventdata, handles) % hObject handle to X (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function R_Callback(hObject, eventdata, handles) % hObject handle to R (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) R= str2double(get(hObject,'String')); % string属性是字符串,所以必须转换成数值 % 检验输入是否为空,是则将它置为0 if (isempty(R)) set(hObject,'String','0') end % 保存handles结构体,只要在handles结构体有改变时,才需要保存 guidata(hObject, handles); % 这里由于handles没有改变,故这里其实没有必要,但是为了避免潜在的不必要麻烦, % 建议在所有Callback最后都添加该命令 % Hints: get(hObject,'String') returns contents of R as text % str2double(get(hObject,'String')) returns contents of R as a double % --- Executes during object creation, after setting all properties. function R_CreateFcn(hObject, eventdata, handles) % hObject handle to R (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit26_Callback(hObject, eventdata, handles) % hObject handle to edit26 (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 edit26 as text % str2double(get(hObject,'String')) returns contents of edit26 as a double % --- Executes during object creation, after setting all properties. function edit26_CreateFcn(hObject, eventdata, handles) % hObject handle to edit26 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit27_Callback(hObject, eventdata, handles) % hObject handle to edit27 (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 edit27 as text % str2double(get(hObject,'String')) returns contents of edit27 as a double % --- Executes during object creation, after setting all properties. function edit27_CreateFcn(hObject, eventdata, handles) % hObject handle to edit27 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit28_Callback(hObject, eventdata, handles) % hObject handle to edit28 (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 edit28 as text % str2double(get(hObject,'String')) returns contents of edit28 as a double % --- Executes during object creation, after setting all properties. function edit28_CreateFcn(hObject, eventdata, handles) % hObject handle to edit28 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit29_Callback(hObject, eventdata, handles) % hObject handle to edit29 (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 edit29 as text % str2double(get(hObject,'String')) returns contents of edit29 as a double % --- Executes during object creation, after setting all properties. function edit29_CreateFcn(hObject, eventdata, handles) % hObject handle to edit29 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit30_Callback(hObject, eventdata, handles) % hObject handle to edit30 (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 edit30 as text % str2double(get(hObject,'String')) returns contents of edit30 as a double % --- Executes during object creation, after setting all properties. function edit30_CreateFcn(hObject, eventdata, handles) % hObject handle to edit30 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in togglebutton3. function togglebutton3_Callback(hObject, eventdata, handles) % hObject handle to togglebutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of togglebutton3 function Zo_Callback(hObject, eventdata, handles) % hObject handle to Zo (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Zo= str2double(get(hObject,'String')); % string属性是字符串,所以必须转换成数值 % 检验输入是否为空,是则将它置为0 if (isempty(Zo)) set(hObject,'String','0') end % 保存handles结构体,只要在handles结构体有改变时,才需要保存 guidata(hObject, handles); % Hints: get(hObject,'String') returns contents of Zo as text % str2double(get(hObject,'String')) returns contents of Zo as a double % --- Executes during object creation, after setting all properties. function Zo_CreateFcn(hObject, eventdata, handles) % hObject handle to Zo (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton10. function pushbutton10_Callback(hObject, eventdata, handles) delete(findobj('color','k'));delete(findobj('color','b'));delete(findobj('color','r'));delete(findobj('color','m')); delete(findobj('color','c')); % 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) % --- Executes on button press in pushbutton11. function pushbutton11_Callback(hObject, eventdata, handles) % hObject handle to pushbutton11 (see GCBO) for R=[0 0.2 0.5 1 2 ]; for X=[-4 -2 -1 -0.5 -0.3 0.3 0.5 1 2 4];%循环输入归一化阻抗 tr=2*pi*(0:0.005:1); rr=1/(1+R);cr=1-rr; plot(cr+rr*cos(tr),rr*sin(tr),'g');%画电阻圆 axis square; hold on; x=X; rx=1/x;cx=rx; tx=2*atan(x)*(0:0.01:1); if tx plot(1-rx*sin(tx),cx-rx*cos(tx),'g')%画电抗圆 else plot(1-rx*sin(tx),-cx-rx*cos(tx),'g') end hold on; end end t=-1:0.001:1;%画横轴 plot(t,0,'g'); axis square; hold on; %鼠标定点数据获取于处理 [U,V]=ginput(1); if(( U^2+V^2)>1) warndlg({'警告:您所取的点已超出圆图范围!','请重新取点!'},'警告'); else R=(1-U^2-V^2)/((1-U)^2+V^2);%阻抗 X=2*V/((1-U)^2+V^2); tr=2*pi*(0:0.00001:1); %z=U+V*j; cosA=U/sqrt(U^2+V^2); sinA=V/sqrt(U^2+V^2); r0=0:0.00001:1; g0=plot(r0*cosA,r0*sinA,'k','linewidth',1.5);%画相角线 axis square; hold on; rr=1/(1+R);cr=1-rr; g1=plot(cr+rr*cos(tr),rr*sin(tr),'r','linewidth',1.5);%画电阻圆 axis square; hold on; x=X; rx=1/x;cx=rx; tx=2*atan(x)*(0:0.0001:1); if tx g2=plot(1-rx*sin(tx),cx-rx*cos(tx),'m','linewidth',1.5);%画电抗圆 else g3=plot(1-rx*sin(tx),-cx-rx*cos(tx),'m','linewidth',1.5); end hold on; r=sqrt(U^2+V^2); g4=plot(r*cos(tr),r*sin(tr),'--','linewidth',1.5);% 等反射系数圆的半径 axis square; hold on; %当有新的图形输入的时候 原来图形被清除,同时保证 第二次取点的时候背景保留。 G=R/(R^2+X^2);%导纳 B=-X/(R^2+X^2); U=(R^2+X^2-1)/(R^2+2*R+1+X^2);%反射系数 V=2*X/(R^2+2*R+1+X^2); zhu_bo_bi=(1+sqrt(U^2+V^2))/(1-sqrt(U^2+V^2));%驻波比 xing_bo_xi_shu=1/zhu_bo_bi; %行波系数 A0=atan(V/U); %相位角 if U<0 A=(180/pi)*(A0+pi); elseif V>=0 A=(180/pi)*A0; else A=(180/pi)*(A0+2*pi); end if V>=0 L=(0.5/360)*(180-A); else L=0.75-(0.5/360)*A; end %波长数 %显示各种参数值 G = num2str(G); % 转换为字符串 set(handles.G,'string',G); B = num2str(B); % 转换为字符串 set(handles.B,'string',B); zhu_bo_bi= num2str(zhu_bo_bi); % 转换为字符串 set(handles.zhu_bo_bi,'string',zhu_bo_bi); xing_bo_xi_shu = num2str(xing_bo_xi_shu); % 转换为字符串 set(handles.xing_bo_xi_shu,'string',xing_bo_xi_shu); U = num2str(U); % 转换为字符串 set(handles.U,'string',U); V = num2str(V); % 转换为字符串 set(handles.V,'string',V); xw = num2str(A); % 转换为字符串 set(handles.xw,'string',xw); bc= num2str(L); % 转换为字符串 set(handles.bc,'string',bc); guidata(hObject, handles); % 更新结构体 end % 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 pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles) % hObject handle to pushbutton12 (see GCBO) %计算并联支节的位置和短路及开路支节的长度 Hdata=get(gcf,'userdata'); %计算并联支节的位置和短路及开路支节的长度 R0= get(handles.R ,'string');%提取电阻电抗值 X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string'); R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo); r=R0/Zo; x=X0/Zo; if R0==Zo m=-x/2; B=(R0^2*m-(Zo-X0*m)*(Zo+X0*m))/(Zo*(R0^2+(Zo+X0*m)^2)); if m>=0 d1=atan(m)/(2*pi); if d1>=0.5 d1=d1-0.5; elseif d1<0 d1=d1+0.5; else d1=d1; end d2=atan(m)/(2*pi); if d2>=0.5 d2=d2-0.5; elseif d2<0 d2=d2+0.5; else d2=d2; end Lo1=(-atan(B*Zo))/(2*pi); if Lo1>=0 Lo1=Lo1; Lo2=Lo1; else Lo1=0.5+Lo1; Lo2=Lo1; end Ls1=(atan(1/(B*Zo)))/(2*pi); if Ls1>=0 Ls1=Ls1; Ls2=Ls1; else Ls1=0.5+Ls1; Ls2=Ls1; end else d1=(atan(m)+pi)/(2*pi); if d1>=0.5 d1=d1-0.5; elseif d1<0 d1=d1+0.5; else d1=d1; end d2=(atan(m)+pi)/(2*pi); if d2>=0.5 d2=d2-0.5; elseif d2<0 d2=d2+0.5; else d2=d2; end Lo1=(-atan(B*Zo))/(2*pi); if Lo1>=0 Lo1=Lo1; Lo2=Lo1; else Lo1=0.5+Lo1; Lo2=Lo1; end Ls1=(atan(1/(B*Zo)))/(2*pi); if Ls1>=0 Ls1=Ls1; Ls2=Ls1; else Ls1=0.5+Ls1; Ls2=Ls1; end end else m1=(X0+sqrt(R0*((Zo-R0)^2+X0^2)/Zo))/(R0-Zo); m2=(X0-sqrt(R0*((Zo-R0)^2+X0^2)/Zo))/(R0-Zo); B1=(R0^2*m1-(Zo-X0*m1)*(X0+Zo*m1))/(Zo*(R0^2+(X0+Zo*m1)^2)); B2=(R0^2*m2-(Zo-X0*m2)*(X0+Zo*m2))/(Zo*(R0^2+(X0+Zo*m2)^2)); Lo1=(-atan(B1*Zo))/(2*pi); if Lo1>=0 Lo1=Lo1; else Lo1=0.5+Lo1; end Lo2=(-atan(B2*Zo))/(2*pi); if Lo2>=0 Lo2=Lo2; else Lo2=0.5+Lo2; end Ls1=(atan(1/(B1*Zo)))/(2*pi); if Ls1>=0 Ls1=Ls1; else Ls1=0.5+Ls1; end Ls2=(atan(1/(B2*Zo)))/(2*pi); if Ls2>=0 Ls2=Ls2; else Ls2=0.5+Ls2; end if m1>=0 d1=atan(m1)/(2*pi); if d1>=0.5 d1=d1-0.5; elseif d1<0 d1=d1+0.5; else d1=d1; end d2=(atan(m2)+pi)/(2*pi); if d2>=0.5 d2=d2-0.5; elseif d2<0 d2=d2+0.5; else d2=d2; end else d1=(atan(m1)+pi)/(2*pi); if d1>=0.5 d1=d1-0.5; elseif d1<0 d1=d1+0.5; else d1=d1; end d2=atan(m2)/(2*pi); if d2>=0.5 d2=d2-0.5; elseif d2<0 d2=d2+0.5; else d2=d2; end end end hold off; %归一化阻抗和确定传播状态 R0= get(handles.R ,'string');%提取电阻电抗值 X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string'); R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo); r=R0/Zo; x=X0/Zo; z=r+i*x; y=1/z; g=real(y); b=imag(y); Gamma2=(z-1)/(z+1); Mod=abs(Gamma2); Phi=angle(Gamma2); Lambda=(pi-Phi)/(4*pi); Alpha=(y-1)/(y+1); plot(real(Alpha),imag(Alpha),'gp'); hold on; plot(real(Gamma2),imag(Gamma2),'gp'); hold on; aa=[real(Alpha),real(Gamma2)]; bb=[imag(Alpha),imag(Gamma2)]; polyfit(aa,bb,1); plot(aa,bb,'g'); hold on; if X0<0 if(Phi>=0) Lmin=Phi/(4*pi); Lmax=0.25+Lmin; else Lmin=(pi+Phi)/(4*pi); Lmax=0.25+Lmin; end else if(Phi>=0) Lmax=Phi/(4*pi); Lmin=0.25+Lmax; else Lmax=(pi+Phi)/(4*pi); Lmin=0.25+Lmax; end end %画出单位圆和标出电刻度 t=0:0.0001:2*pi; plot(cos(t),sin(t),'--g'); hold on; plot([-1,1],[0,0],'g'); hold on; plot([0,0],[-1,1],'g'); hold on; axis('equal',[-1,1,-1,1]); %画出等G圆 if g==inf plot(1,0,'rp'); axis('equal',[-1,1,-1,1]); else a=g/(1+g); g1=1/(1+g); plot((g1*cos(t)+a),(g1*sin(t)),'r'); axis('equal',[-1,1,-1,1]); hold on; end; %画出等B圆 if b==inf plot(1,0,'rp'); axis('equal',[-1,1,-1,1]); elseif b==0 plot([-1,1],[0,0],'r'); axis('equal',[-1,1,-1,1]); else b1=1/b; r2=1/b; plot((r2*cos(t)+1),(r2*sin(t)+b1),'m'); axis('equal',[-1,1,-1,1]); hold on; end; %画出等反射圆和匹配圆 y=g+j*b; gamma=(y-1)/(y+1); Mod=abs(gamma); Phi=angle(gamma); plot(Mod*cos(t),Mod*sin(t),'b'); hold on; axis('equal',[-1,1,-1,1]); plot(0.5*(cos(t)+1),(0.5*sin(t)),'c'); hold off; hold on; %归一化及计参数 R0= get(handles.R ,'string');%提取电阻电抗值 X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string'); R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo); r=R0/Zo; x=X0/Zo; z=r+i*x; y=1/z; Alpha=atan2(imag(Gamma2),real(Gamma2)); alpha1=(y-1)/(y+1); %计算匹配点位置 if R0==Zo plot(real(Gamma2),imag(Gamma2),'rp'); plot(real(Gamma2),-imag(Gamma2),'rp'); m=[0,real(Gamma2)]; Re1=[0,cos(Alpha)]; Im1=[0,sin(Alpha)]; Im2=[0,-sin(Alpha)]; plot(Re1,Im1,'r'); plot(Re1,Im2,'r'); hold off; else angle1=abs(atan2(imag(Gamma2),real(Gamma2))); angle2=2*pi*(d1/0.5)-angle1; if X0>=0 if angle2<0 angle2=2*pi+angle2; plot(-abs(Gamma2)*cos(angle2),abs(Gamma2)*sin(angle2),'rp'); plot(-abs(Gamma2)*cos(angle2),-abs(Gamma2)*sin(angle2),'rp'); Re3=[0,cos(angle2)]; Re4=[0,cos(angle2)]; Im3=[0,sin(angle2)]; Im4=[0,-sin(angle2)]; plot(-Re3,Im3,'r'); plot(-Re4,Im4,'r'); hold off; else angle2=angle2; plot(-abs(Gamma2)*cos(angle2),abs(Gamma2)*sin(angle2),'rp'); plot(-abs(Gamma2)*cos(angle2),-abs(Gamma2)*sin(angle2),'rp'); Re3=[0,cos(angle2)]; Re4=[0,cos(angle2)]; Im3=[0,sin(angle2)]; Im4=[0,-sin(angle2)]; plot(-Re3,Im3,'r'); plot(-Re4,Im4,'r'); hold off; end else angle1=abs(atan2(imag(Gamma2),real(Gamma2))); angle2=2*pi*(d1/0.5)+angle1-2*pi; if angle2<0 angle2=2*pi+angle2; plot(-abs(Gamma2)*cos(angle2),abs(Gamma2)*sin(angle2),'rp'); plot(-abs(Gamma2)*cos(angle2),-abs(Gamma2)*sin(angle2),'rp'); Re3=[0,cos(angle2)]; Re4=[0,cos(angle2)]; Im3=[0,sin(angle2)]; Im4=[0,-sin(angle2)]; plot(-Re3,Im3,'r'); plot(-Re4,Im4,'r'); hold off; else angle2=angle2; plot(-abs(Gamma2)*cos(angle2),abs(Gamma2)*sin(angle2),'rp'); plot(-abs(Gamma2)*cos(angle2),-abs(Gamma2)*sin(angle2),'rp'); Re3=[0,cos(angle2)]; Re4=[0,cos(angle2)]; Im3=[0,sin(angle2)]; Im4=[0,-sin(angle2)]; plot(-Re3,Im3,'r'); plot(-Re4,Im4,'r'); hold off; end end end hold off; rho=(1+abs(Gamma2))/(1-abs(Gamma2)); if R0==Zo set(handles.Ht5,'string',strcat('在d1 = ',num2str(d1),'λ处并接入Lo = ',num2str(Lo1),'λ 的短路支节可实现匹配'),'fontname','宋体','fontsize',10); set(handles.Ht6,'string',strcat('或在d2 = ',num2str(d2),'λ处并接入Ls = ',num2str(Ls1),'λ 的开路支节实现匹配'),'fontname','宋体','fontsize',10); else set(handles.Ht5,'string',strcat('在d1 = ',num2str(d1),'λ处并接入长度为Ls = ',num2str(Ls1),'λ 的短路支节','或Lo = ',num2str(Lo1),'λ 的开路支节可实现匹配'),'fontname','宋体','fontsize',10); set(handles.Ht6,'string',strcat('或在d2 = ',num2str(d2),'λ处并接入长度为Ls = ',num2str(Ls2),'λ 的短路支节','或Lo = ',num2str(Lo2),'λ 的开路支节可实现匹配'),'fontname','宋体','fontsize',10); end % 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 pushbutton13. function pushbutton13_Callback(hObject, eventdata, handles) % hObject handle to pushbutton13 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) R0= get(handles.R ,'string');%提取电阻电抗值 X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string'); R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo); Z=R0+i*X0; Y=1/Z; Yo=1/Zo; G=real(Y); B=imag(Y); m=1; %两支节相距λ/8 m1=(1+m^2)*G*Yo-G^2*m^2; m2=abs(1+m^2)*G*Yo-G^2*m^2; B11=-B+(Yo+sqrt(m1))/m; B21=(Yo*sqrt(m2)+G*Yo)/(G*m); B12=-B+(Yo-sqrt(m1))/m; B22=(-Yo*sqrt(m2)+G*Yo)/(G*m); Ls=-(atan(Yo/B11))/(2*pi); if Ls>=0 Ls11=Ls; else Ls11=0.5+Ls; end Ls=-(atan(Yo/B21))/(2*pi); if Ls>=0 Ls21=Ls; else Ls21=0.5+Ls; end Ls=-(atan(Yo/B12))/(2*pi); if Ls>=0 Ls12=Ls; else Ls12=0.5+Ls; end Ls=-(atan(Yo/B22))/(2*pi); if Ls>=0 Ls22=Ls; else Ls22=0.5+Ls; end hold off; r=R0/Zo; x=X0/Zo; z=r+i*x; y=1/z; g=real(y); b=imag(y); Gamma2=(z-1)/(z+1); Mod=abs(Gamma2); Phi=angle(Gamma2); Lambda=(pi-Phi)/(4*pi); Alpha=(y-1)/(y+1); plot(real(Alpha),imag(Alpha),'gp'); hold on; plot(real(Gamma2),imag(Gamma2),'gp'); hold on; aa=[real(Alpha),real(Gamma2)]; bb=[imag(Alpha),imag(Gamma2)]; polyfit(aa,bb,1); plot(aa,bb,'g'); hold on; if X0<0 if(Phi>=0) Lmin=Phi/(4*pi); Lmax=0.25+Lmin; else Lmin=(pi+Phi)/(4*pi); Lmax=0.25+Lmin; end else if(Phi>=0) Lmax=Phi/(4*pi); Lmin=0.25+Lmax; else Lmax=(pi+Phi)/(4*pi); Lmin=0.25+Lmax; end end %画出单位圆和标出电刻度 t=0:0.0001:2*pi; plot(cos(t),sin(t),'--g'); text (-1.2,0,'0', 'fontname', 'arial','color','b', 'fonta', 'italic'); text (-0.1,1.03,'0. 125', 'fontname', 'arial','color','b', 'fonta', 'italic'); text (1.03,0,'0.25', 'fontname', 'arial','color','b', 'fonta', 'italic'); text (-0.1, -1.18, '0.375', 'fontname', 'arial','color','b', 'fonta', 'italic'); hold on; plot([-1,1],[0,0],'g'); hold on; plot([0,0],[-1,1],'g'); hold on; axis('equal',[-1,1,-1,1]); %画出等G圆 if g==inf plot(1,0,'rp'); axis('equal',[-1,1,-1,1]); else a=g/(1+g); g1=1/(1+g); plot((g1*cos(t)+a),(g1*sin(t)),'r'); axis('equal',[-1,1,-1,1]); hold on; end; %画出等B圆 if b==inf plot(1,0,'rp'); axis('equal',[-1,1,-1,1]); elseif b==0 plot([-1,1],[0,0],'r'); axis('equal',[-1,1,-1,1]); else b1=1/b; r2=1/b; plot((r2*cos(t)+1),(r2*sin(t)+b1),'m'); axis('equal',[-1,1,-1,1]); hold on; end; %画出等反射圆和匹配圆 y=g+j*b; gamma=(y-1)/(y+1); Mod=abs(gamma); Phi=angle(gamma); plot(Mod*cos(t),Mod*sin(t),'b'); hold on; axis('equal',[-1,1,-1,1]); plot(0.5*(cos(t)+1),(0.5*sin(t)),'c'); hold off; hold on; if imag(Ls11)==0 & imag(Ls12)==0 imag(Ls22)==0 t=0:0.0001:2*pi; plot(0.5*(cos(t)),(0.5*sin(t)+0.5),'c'); hold on; r=R/Zo; x=X/Zo; z=r+i*x; y=1/z; g=real(y); imag(Ls21)==0 & & b=imag(y); %计算并画出第二支节的匹配点位置 x1=-tan(2*pi*Ls21); x2=-tan(2*pi*Ls22); y1=1+i*(1/x1); y2=1+i*(1/x2); gamma1=(y1-1)/(y1+1); gamma2=(y2-1)/(y2+1); aa1=real(gamma1); bb1=-imag(gamma1); aa2=real(gamma2); bb2=-imag(gamma2); plot(aa1,bb1,'rp'); plot(aa2,bb2,'rp'); alpha1=atan2(bb1,aa1); alpha2=atan2(bb2,aa2); Re1=[0,cos(alpha1)]; Re2=[0,cos(alpha2)]; Im1=[0,sin(alpha1)]; Im2=[0,sin(alpha2)]; plot(Re1,Im1,'r'); plot(Re2,Im2,'r'); %计算并画出第一支节的匹配点位置 plot(abs(gamma1)*cos(alpha1+pi/2),abs(gamma1)*sin(alpha1+pi/2),'bp'); plot(abs(gamma2)*cos(alpha2+pi/2),abs(gamma2)*sin(alpha2+pi/2),'bp'); Re3=[0,cos(alpha1+pi/2)]; Re4=[0,cos(alpha2+pi/2)]; Im3=[0,sin(alpha1+pi/2)]; Im4=[0,sin(alpha2+pi/2)]; plot(Re3,Im3,'b'); plot(Re4,Im4,'b'); hold off; else t=0:0.0001:2*pi; plot(0.5*(cos(t)),(0.5*sin(t)+0.5),'c'); hold on; [Gamma2,Lmin,Lmax]=circlefun(R,X,Zo); axis('equal',[-1,1,-1,1]); hold off; end hold off; rho=(1+abs(Gamma2))/(1-abs(Gamma2)); if imag(Ls11)==0 & imag(Ls12)==0 & imag(Ls21)==0 & imag(Ls22)==0 set(handles.Ht5,'string',strcat(' 在负载处并入长度为',num2str(Ls11),'λ 的短路支节,再在d=λ/ 8处并入长度为',num2str(Ls21),'λ 的短路支节就可实现匹配'),'fontname','宋体','fontsize',10); set(handles.Ht6,'string',strcat(' 或在负载处并入长度为',num2str(Ls12),'λ 的短路支节,再在d=λ/ 8处并入长度为',num2str(Ls22),'λ 的短路支节就可实现匹配'),'fontname','宋体','fontsize',10); else set(handles.Ht5,'string',strcat(' WARNING ! 等 G 圆与λ/ 8辅助圆无交点'),'fontname','宋体','fontsize',10); set(handles.Ht6,'string',strcat(' 双支节匹配出现盲区!'),'fontname','宋体','fontsize',10); end function V_Callback(hObject, eventdata, handles) % hObject handle to V (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 V as text % str2double(get(hObject,'String')) returns contents of V as a double % --- Executes during object creation, after setting all properties. function V_CreateFcn(hObject, eventdata, handles) % hObject handle to V (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function U_Callback(hObject, eventdata, handles) % hObject handle to U (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 U as text % str2double(get(hObject,'String')) returns contents of U as a double % --- Executes during object creation, after setting all properties. function U_CreateFcn(hObject, eventdata, handles) % hObject handle to U (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit40_Callback(hObject, eventdata, handles) % hObject handle to edit40 (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 edit40 as text % str2double(get(hObject,'String')) returns contents of edit40 as a double % --- Executes during object creation, after setting all properties. function edit40_CreateFcn(hObject, eventdata, handles) % hObject handle to edit40 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end 3.参考资料: 【1】胡鹤飞.Matlab及其应用.北京邮电大学出版社.2012 【2】董金明,林萍实,邓晖.微波技术(第二版).机械工业出版社.2009 【3】Matlab技术论坛 http://www.ilovematlab.cn/ 【4】pudn程序员联合开发网 http://www.pudn.com/ 【5】百度文库 matlab GUI 快速入门
正在阅读:
基于Multisim的同步检波电路的设计 - 图文01-31
银行上半年消保工作典型经验总结10-22
金融消费者权益保护制度建设及执行情况的内部审计报告01-23
我最喜欢的一堂语文课作文600字 - 112-02
美丽达人美容产品投资合作协议03-17
C实验报告6参考答案03-17
蒙医药整理病类12-17
人教版语文三年级上册复习资料(蓝精灵版)06-03
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 原图
- 微波
- 实验
- 报告
- matlab
- smith
- 一元二次方程根与系数的关系应用例析及训练
- 2018-2024年中国聚醚醚酮类树脂行业市场运营态势研究报告(目录
- 多项选择题A
- 圆的面积2导学案
- 桥梁标准化 - 图文
- 80后及其小说创作论述研究性学习结题报告
- 电大仲裁法学答案
- 江苏省镇江市中考化学真题试题(含解析)(1)
- 六年级科学总复习题
- 《会计基础》模拟试卷五
- 工程电磁场实验讲义最新 - 图文
- 人教版小学六年级英语各时态结构总结及练习题(cy)
- 浙江大学远程教育2015年绩效管理在线作业
- 2012年河北职称计算机模拟试题
- 绞肉机毕业都很垃圾论文
- 海淀区生物工程和医药产业技术路线图及三年行动计划研究报告
- 西北师大附中 2015 届高三第五次诊断考试理综
- 国内ABS废料市场价
- 风雨雷电知识
- 得志则加泽于民 - 介绍郑板桥的两首题画诗