一、实验目的
使用计算机程序计算单枝节匹配的问题,得到传输线段长度和枝节长度
二、实验思路
设归一化负载阻抗为,通过传输线长度的阻抗为
其中
于是可以得到传输线长度的导纳为
很容易得到
又因为并联枝节的匹配条件是
解得
同时可以得到传输线段长度和枝节长度的解
三、实验代码
function Single_branch_matching() % 创建图形化界面 fig = figure('Position', [200, 200, 600, 400], 'Name', '单枝节匹配', 'NumberTitle', 'off'); % 标题 title = uicontrol(fig, 'Style', 'text', 'String', '单枝节匹配', 'Position', [200, 350, 200, 30], 'FontSize', 20); % 输入框和标签 wavelength_label = uicontrol(fig, 'Style', 'text', 'String', '请输入波长:', 'Position', [100, 280, 120, 20], 'FontSize', 10); wavelength_input = uicontrol(fig, 'Style', 'edit', 'Position', [230, 280, 100, 20]); z0_label = uicontrol(fig, 'Style', 'text', 'String', '请输入特征阻抗:', 'Position', [100, 240, 120, 20], 'FontSize', 10); z0_input = uicontrol(fig, 'Style', 'edit', 'Position', [230, 240, 100, 20]); z_label = uicontrol(fig, 'Style', 'text', 'String', '请输入阻抗值:', 'Position', [100, 200, 120, 20], 'FontSize', 10); r_input = uicontrol(fig, 'Style', 'edit', 'Position', [230, 200, 50, 20]); j_label = uicontrol(fig, 'Style', 'text', 'String', '+j', 'Position', [280, 200, 20, 20], 'FontSize', 10); x_input = uicontrol(fig, 'Style', 'edit', 'Position', [300, 200, 50, 20]); % 计算按钮 calculate_button = uicontrol(fig, 'Style', 'pushbutton', 'String', '计算', 'Position', [230, 150, 100, 30], 'Callback', @calculate); % 结果标签 result_label = uicontrol(fig, 'Style', 'text', 'String', '', 'Position', [100, 100, 400, 30], 'FontSize', 12); function calculate(~, ~) % 获取输入参数 wavelength = str2double(get(wavelength_input, 'String')); z0 = str2double(get(z0_input, 'String')); r = str2double(get(r_input, 'String')); x = str2double(get(x_input, 'String')); % 归一化阻抗值 r_l = r / z0; x_l = x / z0; if r_l == 1 % 如果负载阻抗的实部等于特性阻抗,则只有一个根,对应一组解 t = -0.5 * x_l; % 计算枝节位置 if t >= 0 d = wavelength * atan(t) / (2 * pi); else d = wavelength * (atan(t) + pi) / (2 * pi); end % 计算枝节长度 b_in = (r_l^2 * t - (1 - x_l * t) * (x_l + t)) / (r_l^2 + (x_l + t)^2); if b_in >= 0 l = atan(1 / b_in) / (2 * pi); else l = (atan(1 / b_in) + pi) / (2 * pi); end % 输出结果 result = ['d = ', num2str(d, '%.6f'), ', l = ', num2str(l, '%.6f')]; set(result_label, 'String', result); else % 结果为两个根,对应两组解 t1 = (x_l + sqrt(r_l * ((r_l - 1)^2 + x_l^2))) / (r_l - 1); t2 = (x_l - sqrt(r_l * ((r_l - 1)^2 + x_l^2))) / (r_l - 1); % 计算枝节位置 if t1 >= 0 d1 = wavelength * atan(t1) / (2 * pi); else d1 = wavelength * (atan(t1) + pi) / (2 * pi); end if t2 >= 0 d2 = wavelength * atan(t2) / (2 * pi); else d2 = wavelength * (atan(t2) + pi) / (2 * pi); end % 计算枝节长度 b_in_1 = (r_l^2 * t1 - (1 - x_l * t1) * (x_l + t1)) / (r_l^2 + (x_l + t1)^2); b_in_2 = (r_l^2 * t2 - (1 - x_l * t2) * (x_l + t2)) / (r_l^2 + (x_l + t2)^2); if b_in_1 >= 0 l1 = wavelength * atan(1 / b_in_1) / (2 * pi); else l1 = wavelength * (atan(1 / b_in_1) + pi) / (2 * pi); end if b_in_2 >= 0 l2 = wavelength * atan(1 / b_in_2) / (2 * pi); else l2 = wavelength * (atan(1 / b_in_2) + pi) / (2 * pi); end % 输出结果 result = ['d1 = ', num2str(d1, '%.6f'), ', l1 = ', num2str(l1, '%.6f'), ' | d2 = ', num2str(d2, '%.6f'), ', l2 = ', num2str(l2, '%.6f')]; set(result_label, 'String', result); end end end
四、实验结果
标签:String,Position,atan,微波,MATLAB,枝节,wavelength,pi,fig From: https://www.cnblogs.com/backsingles/p/17764899.html