2013-11-03 3 views
2

ILSurface에서 서페이스를 플로팅 할 때 밀려났습니다. 시나리오는 다음과 같다 :ILSurface 플롯 매개 변수

플롯 불규칙한 그리드 : 그것은 ILSurface에 플롯 될 수 있도록

float[] x = new float[sizeX]; // filled with timestamps 

float[] y = new float[sizeY]; // filled with values 

float[,] z = new float[sizeX, sizeY]; // filled with values mapped by [x,y] 

ILInArray<float> inX = ILMath.array(x); 
ILInArray<float> inY = ILMath.array(y); 
ILInArray<float> inZ = ILMath.meshgrid(inX * inY, inX, inY); 

// how do i fill the inZ with z[,]? 

ILRetArray<float> outMesh = ILMath.meshgrid(inX, inY, inZ, null, null); 

plotCube.Add(new ILSurface(outMesh, null, null, null, null)); 

// plotCube already attached to the scene, and the scene with the ILPanel 

ilPanel1.Refresh(); 

가 배열이를 매핑 할.

ILInArray<double> ZXYArray을 성공적으로 채우기 위해 ILMath.meshgrid을 사용해 보았습니다.

희망은 분명했습니다. 도움을 환영합니다.

감사합니다.

+0

지금까지의 모든 소스 코드? 예상 결과? 결과를 얻었습니까? –

+0

예상 : 시간 (x)로 분할 된 일련의 fft가있는 표면. 여기서 y (주파수) 및 z (진폭). 획득 : 단지 플롯 큐브가 비어 있습니다. 현재 : ILInArray에 [,] 구문을 어떻게 파싱해야할지 모르겠습니다. 주제에 대한 연구를하고 있습니다. 그 (코드) 올바른 방법인가요? – plac88

답변

1

다음은 ILNumerics로 3D 표면을 플롯하고 사용자 정의 X 및 Y 범위를 제공하는 간단한 예제입니다. 그것은 다음과 같은 결과를 생성

private void ilPanel1_Load(object sender, EventArgs e) { 
    // define X and Y range 
    ILArray<float> X = ILMath.vec<float>(-10.0, 0.1, 10.0); 
    ILArray<float> Y = ILMath.vec<float>(-6.0, 0.1, 6.0); 

    // compute X and Y coordinates for every grid point 
    ILArray<float> YMat = 1; // provide YMat as output to meshgrid 
    ILArray<float> XMat = ILMath.meshgrid(X, Y, YMat); // only need mesh for 2D function here 

    // preallocate data array for ILSurface: X by Y by 3 
    // Note the order: 3 matrix slices of X by Y each, for Z,X,Y coordinates of every grid point 
    ILArray<float> A = ILMath.zeros<float>(Y.Length, X.Length, 3); 

    // fill in Z values (replace this with your own function/data!!) 
    A[":;:;0"] = ILMath.sin(XMat) * ILMath.sin(YMat) * ILMath.exp(-ILMath.abs(XMat * YMat)/5); 
    A[":;:;1"] = XMat; // X coordinates for every grid point 
    A[":;:;2"] = YMat; // Y coordinates for every grid point 

    // setup the scene + plot cube + surface 
    ilPanel1.Scene = new ILScene() { 
     new ILPlotCube(twoDMode: false) { 
      new ILSurface(A) { 
       UseLighting = true, 
       Children = { new ILColorbar() } 
      } 
     } 
    }; 
} 

: 여기서

ILNumerics Surface Plot

은 동일한 예이다 as interactive Web Component이 ILNumerics와 Windows.Forms 애플리케이션의 일반적인 설정을 기대하고있다.

격자 점 좌표가 정의 된 순서에 유의하십시오. 여기에 문서를 참조하십시오 : http://ilnumerics.net/surface-plots.html