在微波技术实验课程中,我学习了用Matlab绘制电磁场分布图,下面分享给大家。
代码如下
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% ==================设置电磁场参数====================
u0 = 4*pi*1e-7; %真空磁导率
e0 = 1/(36*pi)*1e-9; % 自由空间介电常数
z0= sqrt(u0/e0);
k = 2*pi; %波阻抗
f=str2double(get(handles.edit3,'String'));
w = 2*pi*f*1e6; %电磁波频率
phi = str2double(get(handles.edit2,'String')); %初始相位
EE = str2double(get(handles.edit1,'String')); %电场振幅
HH = EE/z0; %磁场振幅
% ============