I'd like to create a top view of a sine graph in dots in Maple, such that the max height is shown with the dots closest together and then the min is shown with the dots furthest apart. It can be lines rather than dots.
Is it possible in Maple? I can use MATLAB too if someone only knows how to do it in MATLAB.
I tried this:
plot3d(sin(x),linestyle=dot);
and this is what I get (I have moved it so that it is top view):
but I want something like this:
or this (sine graph below the dots aligned with the max/min):
If the following is close to what you want then you can fiddle with the distribution. (eg. to get more spread at the low end)
I wasn't sure whether you tried a top-view of a 3D plot because that's what you wanted, or because it was one way to get something like the 2D plot. So I'll do both.
Based on your image it looks to me like you don't just want a sequence with the y-values equi-spaced. Let us know if that's not the case.
restart:
Mx:=Statistics:-RandomVariable(PDF=(x->(sin(x)^1+1.25)/2.25)):
My:=Statistics:-RandomVariable(Uniform(0,1)):
G2D:=proc(r::range(realcons), N::posint)
local v,w;
v:=Vector[column](Statistics:-Sample(Mx,N,
method=[envelope,updates=300,range=r]));
w:=Vector[column](Statistics:-Sample(My,N));
<v|w>;
end proc:
G3D:=proc(r::range(realcons), N::posint)
local v,w;
v:=Vector[column](Statistics:-Sample(Mx,N,
method=[envelope,updates=300,range=r]));
w:=Vector[column](Statistics:-Sample(My,N));
<v|w|map(sin,v)>;
end proc:
a,b := -5*Pi, 5*Pi:
plots:-display(
seq(plot(G2D(a..b, 150),style=point,
symbolsize=7,symbol=solidcircle),
i=0..1, 0.05),
view=[a..b, default],
tickmarks=[piticks,decimalticks]
);
# top view of 3D plot
plots:-pointplot3d(G3D(a..b, 3000),
color=black, symbolsize=7,
orientation=[-90,0,0],
view=[a..b, default, default],
tickmarks=[piticks,default,default]);
You could also adjust or remove the tickmarks, y-range, color, etc.
[update] I'm not sure whether the followup request is for a stacked 2D or 3D plot. Here's something in 2D.
restart:
Mx:=Statistics:-RandomVariable(PDF=(x->(sin(x)^1+1.25)/2.25)):
My:=Statistics:-RandomVariable(Uniform(0,4)):
G2D:=proc(r::range(realcons), N::posint)
local v,w;
v:=Vector[column](Statistics:-Sample(Mx,N,
method=[envelope,updates=300,range=r]));
w:=Vector[column](Statistics:-Sample(My,N));
<v|map(`+`,w,1)>;
end proc:
a,b := -5*Pi, 5*Pi:
plots:-display(
seq(plot(G2D(a..b, 150),style=point,
symbolsize=7,symbol=solidcircle),
i=0..1, 0.05),
plot(sin(x),x=a..b),
view=[a..b, default],
tickmarks=[piticks,[-1,1]]
);