Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'overlay of a surface graph and a contourn graph' topicStudent Support Forum > General > "overlay of a surface graph and a contourn graph"

Next Comment >Help | Reply To Topic
Author Comment/Response
Mauricio Marrone
09/28/98 3:03pm

I am trying to graph a surface graph and the corresponding contourn graph in the same box. HOwever,I alway get the same error, saying that the Nlist contain only two numbers when three are needed. Let me give you my instructions

myCP= ContourPlot[uapproxim[x, y], {x, 0, L}, {y, 0, M}, Contours -> Union[Table[i, {i, 0, 1/4, 1/44}], Table[i, {i, 1/4, 3/2, 1/8}]], PlotPoints -> 30, AspectRatio -> Automatic, PlotRange -> All, ContourLines -> True, ContourShading -> True, ContourStyle -> (Map[{Hue[#, 1, Random[]], Thickness[.006]}&, Range[0, 1, 1/12]]), ColorFunction -> Hue, Ticks -> {Range[0, 1], Range[0, 2], {-1.5, 1.5}}, DisplayFunction -> Identity]

myContourGP= First@Graphics@myCP;
myContourGP= N@myContourGP/.{x_AtomQ, y_AtomQ} -> {x, y, -20};

Show[{SurfaceGraphics@myCP,Graphics3D@myContourGP}, Axes -> True, BoxRatios -> {1, 1, 1}, DisplayFunction -> $DisplayFunction]

the rest of the instructions follow:
L:= 1
M:= 2
l[n_]:= n Pi/L//N
m[n_]:= n Pi/M//N

f1[x_]:= x^2
f2[x_]:= x+2
g1[y_]:= y
g2[y_]:= y+1

A[n_]:=
A[n] = 2/L NIntegrate[f1[x] Sin[l[n] x], {x, 0, L}]//Chop;

B[n_]:=
B[n] = 1/Sinh[l[n] M] (2/L NIntegrate[f2[x] Sin[l[n] x], {x, 0, L}] - A[n] Cosh[l[n] M])//Chop;

Table[{n, A[n], B[n]}, {n, 1, 8}]//ColumnForm
u1[x_, y_, n_]:= (A[n] Cosh[l[n] y] + B[n] Sinh[l[n] y]) Sin[l[n] x]
u1approx[x_, y_]:= Sum[u1[x, y, n], {n, 8}]
threeDplot1 = Plot3D[u1approx[x, y], {x, 0, L}, {y, 0, M}, DisplayFunction-> Identity];
Show[threeDplot1, DisplayFunction->$DisplayFunction]
\[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator]
cvals1:= Table[i, {i, 0, 1/4, 1/44}]
cvals2:= Table[i, {i, 1/4, 3/2, 5/44}]
contourvals:= Union[cvals1, cvals2]
u1[x_, y_, n_]:= (A[n] Cosh[l[n] y] + B[n] Sinh[l[n] y]) Sin[l[n] x]
u1approx[x_, y_]:= Sum[u1[x, y, n], {n, 8}]
contourgraphs1 = ContourPlot[u1approx[x, y], {x, 0, 1}, {y, 0, 2}, PlotPoints -> 40, Contours -> contourvals, ContourShading -> False, DisplayFunction -> Identity];
Show[GraphicsArray[{threeDplot1, contourgraphs1}], DisplayFunction -> $DisplayFunction]
\[SkeletonIndicator]GraphicsArray\[SkeletonIndicator]
a[n_]:= a[n] = 2/M NIntegrate[g1[y] Sin[m[n] y], {y, 0, M}]//Chop
b[n_]:= b[n] = 1/Sinh[m[n] L] (2/M NIntegrate[g2[y] Sin[m[n] y], {y, 0, M}] - a[n] Cosh[m[n] L])//Chop
u2[x_, y_, n_]:= (a[n] Cosh[m[n] x] + b[n] Sinh[m[n] x])* Sin[m[n] y]
u2approx[x_, y_]:= Sum[u2[x, y, n], {n, 1, 8}]
threeDplot2 = Plot3D[u2approx[x, y], {x, 0, L}, {y, 0, M}, DisplayFunction -> Identity];
threeDplot1 = Plot3D[u1approx[x, y], {x, 0, L}, {y, 0, M}, DisplayFunction-> Identity];
Show[threeDplot1, DisplayFunction->$DisplayFunction]
\[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator]
contourgraphs2= ContourPlot[u2approx[x, y], {x, 0, 1}, {y, 0, 2}, PlotPoints -> 40, Contours -> contourvals, ContourShading -> False, DisplayFunction -> Identity];
Show[GraphicsArray[{threeDplot2, contourgraphs2}], DisplayFunction -> $DisplayFunction]
\[SkeletonIndicator]GraphicsArray\[SkeletonIndicator]
uapproxim[x_, y_]:= u1approx[x, y]+ u2approx[x, y];
threeDplot= Plot3D[uapproxim[x, y], {x, 0, L}, {y, 0, M}, DisplayFunction -> Identity];
contourgraphsu= ContourPlot[uapproxim[x, y], {x, 0, 1}, {y, 0, 2}, PlotPoints -> 40, Contours -> contourvals, ContourShading -> False, DisplayFunction -> Identity];
Show[GraphicsArray[{threeDplot, contourgraphsu}], DisplayFunction -> $DisplayFunction]
\[SkeletonIndicator]GraphicsArray\[SkeletonIndicator]

I need urgent help.
Thanks

URL: ,

Subject (listing for 'overlay of a surface graph and a contourn graph')
Author Date Posted
overlay of a surface graph and a contourn graph Mauricio Mar... 09/28/98 3:03pm
Re: overlay of a surface graph and a contourn g... Forum Modera... 09/29/98 3:20pm
Next Comment >Help | Reply To Topic