파일:Rosenbrock function.svg

testwiki
둘러보기로 이동 검색으로 이동
    원본 파일 (SVG 파일, 실제 크기 720 × 540 픽셀, 파일 크기: 2.28 MB)

    이 파일은 위키미디어 공용에 있으며, 다른 프로젝트에서 사용하고 있을 가능성이 있습니다. 해당 파일에 대한 설명이 아래에 나와 있습니다.

    파일 설명

    설명
    English: Rosenbrock function over ℝ2. The Python code needs at least Matplotlib v0.99. The MATLAB/Octave code was tested with GNU Octave 4.2.2 and MATLAB R2016a.
    Español: Funció de Rosenbrock definida sobre ℝ2.
    날짜
    출처 자작
    저자 Morn the Gorn
    Python source
    InfoField
    click to expand
    from mpl_toolkits.mplot3d import Axes3D
    from matplotlib.colors import LogNorm
    import matplotlib.pyplot as plt
    import numpy as np
    
    fig = plt.figure()
    ax = Axes3D(fig, azim=-128, elev=43)
    s = .05
    X = np.arange(-2, 2.+s, s)
    Y = np.arange(-1, 3.+s, s)
    X, Y = np.meshgrid(X, Y)
    Z = (1.-X)**2 + 100.*(Y-X*X)**2
    # ax.plot_surface(X, Y, Z, rstride=1, cstride=1, norm = LogNorm(),
    #                 cmap="viridis")
    # Without using `` linewidth=0, edgecolor='none' '', the code may produce a
    # graph with wide black edges, which will make the surface look much darker
    # than the one illustrated in the figure above.
    ax.plot_surface(X, Y, Z, rstride=1, cstride=1, norm=LogNorm(),
                    linewidth=0, edgecolor='none', cmap="viridis")
    
    # Set the axis limits so that they are the same as in the figure above.
    ax.set_xlim([-2, 2.0])                                                       
    ax.set_ylim([-1, 3.0])                                                       
    ax.set_zlim([0, 2500]) 
    
    plt.xlabel("x")
    plt.ylabel("y")
    plt.savefig("Rosenbrock function.svg", bbox_inches="tight")
    
    plt.show()
    
    MATLAB/Octave source
    InfoField
    click to expand
    clear all;
    close all;
    hfig = figure(1);
    
    s = 0.05;
    X = [-2 : s : 2+s];
    Y = [-1 : s : 3+s];
    [X, Y] = meshgrid(X, Y);
    Z = (1-X).^2 + 100*(Y-X.^2).^2;
    
    % Use log scale of Z for a batter usage of the color spectrum  
    minZ = min(Z(:));  
    maxZ = max(Z(:));
    C = minZ + (maxZ-minZ).*log(1+Z-minZ)./log(1+maxZ-minZ); 
    % See
    % http://stackoverflow.com/questions/5073865/how-to-color-surface-with-stronger-contrast
    % for how to color a surface with a even stronger contrast.   
    % The method is as follows:
    %C = Z;
    %[~, index] = sort(C(:));
    %C(index) = 1 : numel(index);
    
    colormap(jet);
    surf(X, Y, Z, C, 'EdgeColor', 'none', 'LineStyle', 'none');
     
    axis([-2, 2, -1, 3, 0, 2500]);
    xlabel('x', 'fontsize', 18);
    ylabel('y', 'fontsize', 18);
    zlabel('f', 'fontsize', 18);
     
    % Note that the `-dsvg' option is only supported for Simulink systems
    print(hfig, '-dsvg', 'rosenbrock');
    % To produce eps and pdf, use the following code. Notice that `epstopdf' may not work on Windows. 
    print(hfig, '-depsc', 'rosenbrock');
    system('epstopdf rosenbrock.eps');
    

    라이선스

    Public domain 나는 이 작품의 저작권자로서, 이 작품을 퍼블릭 도메인으로 모두에게 공개합니다. 이 공개 선언은 전 세계적으로 유효합니다.
    만약 저작권의 포기가 법률적으로 가능하지 않은 경우,
    나는 이 작품을 법적으로 허용되는 한도 내에서 누구나 자유롭게 어떤 목적으로도 제한없이 사용할 수 있도록 허용합니다.

    설명

    이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다

    이 파일에 묘사된 항목

    다음을 묘사함

    image/svg+xml

    파일 역사

    날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

    날짜/시간섬네일크기사용자설명
    현재2020년 6월 5일 (금) 02:192020년 6월 5일 (금) 02:19 판의 섬네일720 × 540 (2.28 MB)wikimediacommons>ZhangzkThe original colour looks much better (Reverted to version as of 11:52, 6 April 2010 (UTC))

    이 파일을 사용하는 문서가 없습니다.