matplotlib - Surface plot from three 1d arrays with different size -
i want plot following quadratic form:
f(x) = 1/2 x^t * * x -b^t *x where 2x2 matrix. x1-axis: [-6,4] x2-axis: [-4,6]
i did following:
x = arange(-6,4,0.1) y = arange(-4,6,0.1) so both x , y conatain 100 points. want evaluate quadratic form @ pairs of points, i.e. 100*100 = 10000 points.
done following code:
res= [] in x: b in y: val = f(array([a,b])) res.append(val) now want make kind of surface plot. can me figure out how this? tried:
fig = plt.figure() ax = fig.add_subplot(111, projection='3d') surf = ax.plot_surface(x, y, res) i think following method should not know how exactly:
griddata- interpolates nonuniformly spaced grid other grid.
any ideas?
Comments
Post a Comment