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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -