I am trying to use octave to do a data approximation project, but I am running into some trouble testing some basic things. I'm not very experienced with octave, so I was hoping someone could point me in the right direction.
I'm attempting to generate a list of x,y points using the Halton sequence. I want to plug those x,y points into the peaks function to get the z peaks values for those coordinates. Next, I want to plot those x,y,z points to be sure that my plot resembles the peak plot, but my plot looks wrong.
Here is the code:
%13 for this example to compare to meshgrid
N = 13;
%creates a halton sequence for N and scales it between -3 to 3
seq = haltonseq(N, 2) * 6 – 3;
%save the x,y coordinate from the halton sequence
X = seq(:,1);
Y = seq(:,2);
%convert the x,y vector in matrixes
X = repmat(X, 1, N)';
Y = repmat(Y,1,N);
%get the z values for x,y
Z = peaks(X, Y);
%plot my x,y,z values
surf(X,Y,Z);
%plot meshgrid to compare to
[mX mY] = meshgrid(-3:0.5:3);
mZ = peaks(mX, mY);
surf(mX, mY, mZ);
The Halton sequence is correct, but I will include it for verification. This is after it has been scaled to be between -3 and 3:
seq =
0.00000 -1.00000
-1.50000 1.00000
1.50000 -2.33333
-2.25000 -0.33333
0.75000 1.66667
-0.75000 -1.66667
2.25000 0.33333
-2.62500 2.33333
0.37500 -2.77778
-1.12500 -0.77778
1.87500 1.22222
-1.87500 -2.11111
1.12500 -0.11111
Mesh Graph:
Halton Graph N = 13:
Halton Graph N = 300:
Now, to the best of my understanding of this code, the Halton sequence plot should not look like it does, and as I increase N, it should resemble the meshgrid graph more, but it keeps its same deformed shape. I'm not sure where I am going wrong, can someone point me in the right direction?
Note: I am using this code with Octave now, but I will also be using it with Matlab later, so I tagged it as both.





