微波实验报告 smith原图 matlab(4)

2019-03-03 22:35

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


微波实验报告 smith原图 matlab(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:房地产估价报告9 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: