I have done calculations with 2 different methods. For those calculations I have varied 2 parameters: x and y
In the end, I have calculated the % ERROR between both
create the grid for the first and second column and calculate Z using your formula. help meshgrid in MATLAB
The surf function needs a grid of X,Y
-values as input. Your data however is simply three vectors with some combinations, not a full grid. As described in the documentation, the meshgrid function is often helpful to create such grid matrices. Use the unique
function to select all unique values in x
and y
and create matrices of all possible combinations:
[X,Y] = meshgrid(unique(x),unique(y));
To create a Z
matrix which fits the [X,Y]
grid, the griddata function is helpful:
Z = griddata(x,y,z,X,Y);
Now you can call surf
with the grid matrices as input:
surf(X,Y,Z);