comparison reshapeToPlotMatrixTest.m @ 163:51aaf67a7df5 feature/grids

Fixed naming and added functions for converting vectors to matrices for structured grid.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 22 Feb 2016 13:55:19 +0100
parents c75c03f692b3
children
comparison
equal deleted inserted replaced
162:c75c03f692b3 163:51aaf67a7df5
1 function tests = funcToPlotMatrixTest() 1 function tests = reshapeToPlotMatrixTest()
2 tests = functiontests(localfunctions); 2 tests = functiontests(localfunctions);
3 end 3 end
4 4
5 function test1D(testCase) 5 function test1D(testCase)
6 inGf = [1 2 3 4 5]'; 6 inGf = [1 2 3 4 5]';
7 inM = 5; 7 inM = 5;
8 out = [1 2 3 4 5]'; 8 out = [1 2 3 4 5]';
9 testCase.verifyEqual(grid.funcToPlotMatrix(inGf, inM),out); 9 testCase.verifyEqual(reshapeToPlotMatrix(inGf, inM),out);
10 end 10 end
11 11
12 function test2D(testCase) 12 function test2D(testCase)
13 x = 1:2; 13 x = 1:2;
14 y = 1:3; 14 y = 1:3;
22 [X,Y] = meshgrid(x,y); 22 [X,Y] = meshgrid(x,y);
23 out = f(X,Y); 23 out = f(X,Y);
24 24
25 inM = [2, 3]; 25 inM = [2, 3];
26 26
27 testCase.verifyEqual(grid.funcToPlotMatrix(inGf, inM),out); 27 testCase.verifyEqual(reshapeToPlotMatrix(inGf, inM),out);
28 end 28 end
29 29
30 function test3D(testCase) 30 function test3D(testCase)
31 x = 1:2; 31 x = 1:2;
32 y = 1:3; 32 y = 1:3;
42 [X,Y,Z] = meshgrid(x,y,z); 42 [X,Y,Z] = meshgrid(x,y,z);
43 out = f(X,Y,Z); 43 out = f(X,Y,Z);
44 44
45 inM = [2, 3, 4]; 45 inM = [2, 3, 4];
46 46
47 testCase.verifyEqual(grid.funcToPlotMatrix(inGf, inM),out); 47 testCase.verifyEqual(reshapeToPlotMatrix(inGf, inM),out);
48 end 48 end