⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 capped_wedge_gui.m

📁 matlab code for digital signal processing
💻 M
📖 第 1 页 / 共 3 页
字号:
                                    EzLS(m) = Term0C*ssterm*Aterm/Bterm;   
                                case 'None'               
                                    EzLS(m) = Term0*ssterm*besselj(v,krhop);      
                            end          
                        end
                        EzFLs(ip) = abs(sum(EzLS));
                    else 
                        EzFLs(ip)=0;
                    end
                end
                EzFLs = EzFLs/max(EzFLs);
                
                figure(1);
                plot(xphi,EzFLs,'linewidth',1.5);
                xlabel('Observation angle \phi^o'); 
                ylabel('Ez');
                axis ([0 360 0 1])
                title('Total Far Field (Ez) [Line source excitation]');
                
                figure(2)
                polardb(xphi*dtr,EzFLs,'k')
                title ('Total Far Field (Ez) [dB]')
                
            case 'Near Field'
                %   <<<   Near field observation points   >>>
                delx = 2*ax/nx; dely = 2*by/ny;
                xi = -ax;   yi = -by;           % Initial values for x and y
                
                for i = 1:nx
                    for j = 1:ny
                        x(i,j) = xi + (i-1)*delx;
                        y(i,j) = yi + (j-1) *dely;
                        rho(i,j) = sqrt(x(i,j)^2+y(i,j)^2);
                        phi(i,j) = atan2(y(i,j),x(i,j));
                        if phi(i,j) < 0
                            phi(i,j) = phi(i,j) + 2*pi;
                        end    
                        if rho(i,j) <= 0.001
                            rho(i,j) = 0.001;
                        end
                    end 
                end
                
                %    Line source excitation, near field calculations
                
                %    ====   Line source coefficients    ====
                Nc =round(1+2*k*max(max(rho)));          % number of terms for series summation  
                Term   = Ie*pi*omega*mu0/(2*pi-alpha-beta);
                
                for m = 1:Nc  
                    v = m*vi;     
                    switch CapType
                        case 'Dielectric'
                            b(m) = -Term * besselh(v,2,krhop);
                            c(m) = -b(m) * (k*dbesselj(v,ka)*besselj(v,k1a)-k1*besselj(v,ka)*dbesselj(v,k1a)) ...
                                / (k*dbesselh(v,2,ka)*besselj(v,k1a)-k1*besselh(v,2,ka)*dbesselj(v,k1a));
                            d(m) = c(m) + b(m) * besselj(v,krhop) / besselh(v,2,krhop);
                            a(m) = ( b(m) * besselj(v,ka)+c(m) * besselh(v,2,ka))/besselj(v,k1a);
                        case 'Conductor'
                            b(m) = -Term * besselh(v,2,krhop);
                            c(m) = -b(m) * besselj(v,ka)/besselh(v,2,ka);
                            d(m) = c(m) + b(m) * besselj(v,krhop) / besselh(v,2,krhop);
                            a(m) = 0;
                        case 'None'               
                            b(m) = -Term * besselh(v,2,krhop);
                            c(m) = 0;
                            d(m) = -Term * besselj(v,krhop); 
                            a(m) = b(m);  
                    end          
                end
                
                termhphi = sqrt(-1)*omega*mu0;
                termhrho = -termhphi;
                for i = 1:nx
                    for j = 1:ny
                        for m = 1:Nc
                            v = m*vi;  % Equation 
                            [Ezt,Hphit,Hrhot] = DielCappedWedgeTMFields_Ls(v,m,rho(i,j),phi(i,j),rhop, ...
                                phip,ar,k,k1,alpha,beta,a,b,c,d);
                            Eztt(m) = Ezt;
                            Hphitt(m) = Hphit;
                            Hrhott(m) = Hrhot;
                        end
                        SEz(i,j) = sum(Eztt);
                        SHphi(i,j) = sum(Hphitt)/termhphi;
                        SHrho(i,j) = sum(Hrhott)/termhrho;
                    end
                end
                figure(3);
                surf(x,y,abs(SEz));
                axis ('equal'); 
                view(45,60); 
                shading interp;
                xlabel('x'); 
                ylabel('y'); 
                zlabel('E_z');
                title('Ez [Line source excitation]');
                colorbar
                
                figure(4);
                surf(x,y,377*abs(SHrho));
                axis ('equal');
                view(45,60);  
                shading interp;
                xlabel('x'); 
                ylabel('y'); 
                zlabel('\eta_o  H\rho');
                title('\eta_o  H\rho [Line source excitation]');
                colorbar
                
                figure(5);
                surf(x,y,377*abs(SHphi));
                axis ('equal');
                view(45,60); 
                shading interp;
                xlabel('x'); 
                ylabel('y'); 
                zlabel('\eta_o  H\phi');
                title('\eta_o  H\phi [Line source excitation]')
                colorbar
        end
    case 'Plane Wave'
        
        popm2 = get(findobj(h2,'Tag','popupmenu2'),'Value');
        if popm2 == 1
            %   <<<   Near field observation points   >>>
            delx = 2*ax/nx; dely = 2*by/ny;
            xi = -ax;   yi = -by;           % Initial values for x and y
            
            for i = 1:nx
                for j = 1:ny
                    x(i,j) = xi + (i-1)*delx;
                    y(i,j) = yi + (j-1) *dely;
                    rho(i,j) = sqrt(x(i,j)^2+y(i,j)^2);
                    phi(i,j) = atan2(y(i,j),x(i,j));
                    if phi(i,j) < 0
                        phi(i,j) = phi(i,j) + 2*pi;
                    end    
                    if rho(i,j) <= 0.001
                        rho(i,j) = 0.001;
                    end
                end 
            end
            
            %   ===   Plane wave excitation, near field calculations   ===
            Nc =round(1+2*k*max(max(rho)));          % number of terms for series summation  
            Term   = 4*pi/(2*pi-alpha-beta);
            for m = 1:Nc  
                v = m*vi;     
                switch CapType
                    case 'Dielectric'
                        b(m) = Term * img^v;
                        c(m) = -b(m) * (k*dbesselj(v,ka)*besselj(v,k1a)-k1*besselj(v,ka)*dbesselj(v,k1a)) ...
                            / (k*dbesselh(v,2,ka)*besselj(v,k1a)-k1*besselh(v,2,ka)*dbesselj(v,k1a));
                        a(m) = ( b(m) * besselj(v,ka)+c(m) * besselh(v,2,ka))/besselj(v,k1a);
                    case 'Conductor'
                        b(m) = -Term * img^v;
                        c(m) = -b(m) * besselj(v,ka)/besselh(v,2,ka);
                        a(m) = 0;
                    case 'None'               
                        b(m) = -Term * img^v;
                        c(m) = 0;
                        a(m) = b(m);  
                end          
            end
            
            
            termhphi = sqrt(-1)*omega*mu0;
            termhrho = -termhphi;
            for i = 1:nx
                for j = 1:ny
                    for m = 1:Nc
                        v = m*vi;  % Equation 
                        [Ezt,Hphit,Hrhot] = DielCappedWedgeTMFields_PW(v,m,rho(i,j),phi(i,j), ...
                            phip,ar,k,k1,alpha,beta,a,b,c);
                        Eztt(m) = Ezt;
                        Hphitt(m) = Hphit;
                        Hrhott(m) = Hrhot;
                    end
                    EzPW(i,j) = sum(Eztt);
                    HphiPW(i,j) = sum(Hphitt)/termhphi;
                    HrhoPW(i,j) = sum(Hrhott)/termhrho;
                end
            end   
            
            figure(6);
            surf(x,y,abs(EzPW));
            axis ('equal');
            view(45,60); 
            shading interp;
            xlabel('x'); 
            ylabel('y'); 
            zlabel('E_z');
            colorbar
            title('Near Field (Ez) [Plane wave excitation]');
            
            figure(7);
            surf(x,y,377*abs(HrhoPW));
            axis ('equal');
            view(45,60); 
            shading interp;
            xlabel('x'); 
            ylabel('y'); 
            zlabel('\eta_o H\rho');
            title('\eta_o H\rho [Plane wave excitation]');
            colorbar
            
            figure(8);
            surf(x,y,377*abs(HphiPW));
            axis ('equal');
            view(45,60); 
            shading interp;
            xlabel('x'); 
            ylabel('y'); 
            zlabel('\eta_o H\phi');
            title('\eta_o H\phi [Plane wave excitation]');
            colorbar        
        endend% --- Executes during object creation, after setting all properties.function edit14_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit14 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit14_Callback(hObject, eventdata, handles)% hObject    handle to edit14 (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 edit14 as text%        str2double(get(hObject,'String')) returns contents of edit14 as a double% --- Executes during object creation, after setting all properties.function edit15_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit15 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit15_Callback(hObject, eventdata, handles)% hObject    handle to edit15 (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 edit15 as text%        str2double(get(hObject,'String')) returns contents of edit15 as a double% --- Executes during object creation, after setting all properties.function edit16_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit16 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit16_Callback(hObject, eventdata, handles)% hObject    handle to edit16 (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 edit16 as text%        str2double(get(hObject,'String')) returns contents of edit16 as a double% --- Executes during object creation, after setting all properties.function edit17_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit17 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit17_Callback(hObject, eventdata, handles)% hObject    handle to edit17 (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 edit17 as text%        str2double(get(hObject,'String')) returns contents of edit17 as a double% --- Executes during object creation, after setting all properties.function edit18_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit18 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit18_Callback(hObject, eventdata, handles)% hObject    handle to edit18 (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 edit18 as text%        str2double(get(hObject,'String')) returns contents of edit18 as a double

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -