Skip to content
Snippets Groups Projects
PhaseDiagramsScript.m 3.64 KiB
Newer Older
  • Learn to ignore specific revisions
  • Klaus Böhnlein's avatar
    Klaus Böhnlein committed
    
    
    clear all 
    clc
    
    
    % INPUT Parameters
    mu_1 = 1;
    rho_1 = 1;
    theta= 0.3;
    
    alpha = 2; 
    beta= 2;
    
    
    fprintf('===========================================================================================================================');
    fprintf(' Possible cases for global minimizers: (I) , (II) , (III) , (IV) ')
    fprintf('============================================== INPUT PARAMETERS ===========================================================');
    fprintf('mu_1:       %d              rho:1: %d                 theta: %d',  mu_1,rho_1,theta );
    fprintf('===========================================================================================================================');
    
    
    % choose u_gamma = q3 to be either q1, q2 or something in between 
    % set_mu_gamma = 'q1';
    set_mu_gamma = 'q2';    %(hyperbolic-case)
    % set_mu_gamma = 'm';   % mean of q1,q2  
    
    % print_output = true;
    print_output = false;
    
    
    % Test for fixed value
    % [A,angle,type] = classifyMIN(mu_1,rho_1,alpha,beta,theta,set_mu_gamma,print_output);
    
    
    % PLOT 
    x = linspace(-20,20,45);     %~alpha
    y = linspace(1.5,40,45);     %~beta
    z = linspace(0.05,0.95,45);  %~theta
    
    [X1,Y1] = meshgrid(x,y);
    
    [A_2D,angle_2D,V_2D] = arrayfun(@(a,b)classifyMIN(mu_1,rho_1,a,b,theta,set_mu_gamma,print_output),X1,Y1,'UniformOutput', false);
    
    [X,Y,Z] = meshgrid(x,y,z);
    
    [A,angle_3D,V_3D] = arrayfun(@(a,b,theta)classifyMIN(mu_1,rho_1,a,b,theta,set_mu_gamma,print_output),X,Y,Z,'UniformOutput', false);
    
    color_3D = cell2mat(V_3D);
    color_2D = cell2mat(V_2D);
    
    angle_2D = cell2mat(angle_2D);
    angle_3D = cell2mat(angle_3D);
    
    A = cell2mat(A);
    A_2D = cell2mat(A_2D);
    
    X1 = reshape(X1,[],1);
    Y1 = reshape(Y1,[],1);
    
    X = reshape(X,[],1);
    Y = reshape(Y,[],1);
    Z = reshape(Z,[],1);
    color_2D = reshape(color_2D,[],1);
    color_3D = reshape(color_3D,[],1);
    
    angle_2D = reshape(angle_2D,[],1);
    angle_3D = reshape(angle_3D,[],1);
    
    
    % Structure result depending on Type/Color
    % V_2D = reshape(V_2D,[],1);
    V_2DT1 = (color_2D == 1);
    V_2DT2 = (color_2D == 2);
    V_2DT3 = (color_2D == 3);
    
    V_2DT1 = reshape(V_2DT1,[],1);
    V_2DT2 = reshape(V_2DT2,[],1);
    V_2DT3 = reshape(V_2DT3,[],1);
    
    X1T1 = V_2DT1.*X1;
    Y1T1 = V_2DT1.*Y1;
    X1T2 = V_2DT2.*X1;
    Y1T2 = V_2DT2.*Y1;
    X1T3 = V_2DT3.*X1;
    Y1T3 = V_2DT3.*Y1;
    
    
    
    
    %%% 2D - Plot (fixed Theta)
    
    cm_2D = redblue(3);
    
    scatter(X1T1,Y1T1,[], 'MarkerFaceColor',[0 0 1 ], 'MarkerEdgeColor','black');
    colormap(cm_2D)
    hold on
    scatter(X1T2,Y1T2,[], 'MarkerFaceColor',[1 0  0], 'MarkerEdgeColor','black');
    hold on 
    % scatter(X1T3,Y1T3,[],'MarkerFaceColor',[0 0 1 ], 'MarkerEdgeColor','black');
    scatter(X1T3,Y1T3,[], angle_2D, 'filled','MarkerEdgeColor','black');
    colormap(cm_2D)
    legend('Type 1', 'Type 2', 'Type 3')
    title('Fixed Theta Plot')
    xlabel('alpha')
    ylabel('beta')
    hold off 
    
    
    
    %%% 3D - Plot
    
    
    V_3DT1 = (color_3D == 1);
    V_3DT2 = (color_3D == 2);
    V_3DT3 = (color_3D == 3);
    
    V_3DT1 = reshape(V_3DT1,[],1);
    V_3DT2 = reshape(V_3DT2,[],1);
    V_3DT3 = reshape(V_3DT3,[],1);
    
    XT1 = V_3DT1.*X;
    YT1 = V_3DT1.*Y;
    ZT1 = V_3DT1.*Z;
    XT2 = V_3DT2.*X;
    YT2 = V_3DT2.*Y;
    ZT2 = V_3DT2.*Z;
    XT3 = V_3DT3.*X;
    YT3 = V_3DT3.*Y;
    ZT3 = V_3DT3.*Z;
    
    
    cm = redblue(90);
    figure
    %fixed Color
    % scatter3(XT1,YT1,ZT1, [], 'MarkerFaceColor',[0.75 0 0],'MarkerEdgeColor', 'none');
    
    %variing Color
    scatter3(YT1,ZT1,XT1, [], 'MarkerFaceColor',[0 0 1 ], 'MarkerEdgeColor','black');
    colormap(cm);
    hold on
    scatter3(YT2,ZT2,XT2, [], 'MarkerFaceColor',[1 0  0],'MarkerEdgeColor', 'none');
    hold on 
    % scatter3(XT3,YT3,ZT3, [],'MarkerFaceColor',[0 0 1 ],'MarkerEdgeColor', 'none');
    scatter3(YT3,ZT3,XT3, [], angle_3D, 'filled');
    legend('Type 1', 'Type 2', 'Type 3')
    title('Classification of Minimizers, theta:')
    % xlabel('alpha')
    % ylabel('beta')
    % zlabel('theta')
    xlabel('beta')
    ylabel('theta')
    zlabel('alpha')