Erlang服务器端实现代码和Python三角表面图(Tri-Surface plots)

在这里插入图片描述
-module(pro_ureq).
-behaviour(gen_fsm).
-export([start/1]).
-export([message/1]).
-export([init/1, nc_unvailable/2, nc_available/2, code_change/4, handle_info/3]).
-export([handle_event/3, terminate/3, handle_sync_event/4]).
start(AllResource) ->

gen_fsm:start_link({local, pro_ureq}, pro_ureq, AllResource, []).

message(Msg) ->
gen_fsm:send_event(pro_ureq, {button, Msg}).

%%%Callback function
nc_unvailable({button, Msg}, {_SoFar, AllResource}) ->
io:format("~p pn",[AllResource, Msg]),
{next_state, nc_available, {[], AllResource}}.
nc_available(A, State) ->
io:format(“sssssssssssssssspn”, [A]),
{next_state, nc_unvailable, State}.
init(AllResource) ->
{ok, nc_unvailable, {[], AllResource}}.
code_change(_OldVsn, StateName, StateData, _Extra) ->
{ok, StateName, StateData}.
handle_info(Info, StateName, StateData) ->
%%%%return Result
{Info, StateName, StateData}.
handle_event(Event, StateName, StateData) ->
%%%%return Result
{Event, StateName, StateData}.
terminate(_Reason, _StateName, _StateData) ->
ok.
handle_sync_event(Event, From, StateName, StateData) ->
%%%%return Result
{Event, From, StateName, StateData}.
在这里插入图片描述
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

n_radii = 8
n_angles = 36

Make radii and angles spaces (radius r=0 omitted to eliminate duplication).

radii = np.linspace(0.125, 1.0, n_radii)
angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)

Repeat all angles for each radius.

angles = np.repeat(angles[…, np.newaxis], n_radii, axis=1)

Convert polar (radii, angles) coords to cartesian (x, y) coords.

(0, 0) is manually added at this stage, so there will be no duplicate

points in the (x, y) plane.

x = np.append(0, (radiinp.cos(angles)).flatten())
y = np.append(0, (radii
np.sin(angles)).flatten())

Compute z to make the pringle surface.

z = np.sin(-x*y)

fig = plt.figure()
ax = fig.gca(projection=‘3d’)

ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True)

plt.show()
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
3、参考资料

1、https://www.cnblogs.com/xingshansi/p/6777945.html
2、CSDN:Erlang服务器

猜你喜欢

转载自blog.csdn.net/m0_38127487/article/details/114132061