tikzを使用して、三角形の定義域上に2つの関数を一緒にプロットする必要があります。それ、どうやったら出来るの?
I Need Plot Two Functions Together Over Triangular Domains Using Tikz
解決:
私はあなたの2番目のリンクのオプションに行きます。次のように三角形をパラメータ化できます。
- 三角形(0,0)、(0,1)、(1,1):
x = u * v、y = v、0<=u,v<=1.
- 三角形(0,0)、(1,0)、(1,1):
x = u、y = u * v、0<=u,v<=1.
たとえば、放物面をプロットしたい場合z = 2-x ^ 2 + y ^ 2 = 2-u ^ 2 * v ^ 2-v ^ 2(最初の三角形)および
z = x ^ 2 + y ^ 2 = u ^ 2 + u ^ 2 * v ^ 2(2番目の三角形)次のことができます。
documentclass {standalone} usepackage {pgfplots} pgfplotsset {compat = 1.17} begin {document} begin {tikzpicture} begin {axis} [xlabel = $ x $、ylabel = $ y $、zmin = 0、zmax = 2、変数= u、変数y = v、view = {30} {45}]%(0,0)(0,1)(1,1)パラメーター化x = u * v、y = v --- > x、y、2- x ^ 2 -y ^ 2 addplot3 [surf、domain = 0:1、y domain = 0:1、colormap name = hot](u * v、v、2-u ^ 2 * v ^ 2-v ^ 2); %(0,0)(1,0)(1,1)パラメーター化x = u、y = u * v ---> x、y、x ^ 2 + y ^ 2 addplot3 [surf、domain = 0: 1、yドメイン= 0:1、カラーマップ名= viridis、不透明度= 0.8](u、u * v、u ^ 2 + u ^ 2 * v ^ 2); end {axis} end {tikzpicture} end {document}
tikzを使用した簡単な例は次のとおりです。
更新:メッシュラインが追加されました
%!Texプログラム= xelatex%!Texエンコーディング= UTF-8 documentclass [tikz、border = 0pt] {スタンドアロン} usetikzlibrary {calc} usetikzlibrary {arrows} usetikzlibrary {perspective} usepackage {xcolor} begin {document }%色を定義 colorlet {fillbottom} {yellow!60} colorlet {filltop} {blue!20} colorlet {curvecolor} {red} colorlet {meshcolor} {orange} begin {tikzpicture} [3d view = { 60} {30}、scale = 2]%===================================%表面1: z = xy、ドメイン境界x = 1、y = x、y = 0%サーフェス2:z = x ^ 2 + y ^ 2、ドメイン境界y = x、y = 1、x = 0%===== ============================== tikzset {%declare function = {%% f( u、 v)= u * v; g( u、 v)= u ^ 2 + v ^ 2; } %%}% def xa {1} def xb {1}%座標を設定 def mxmin {0} def xdash {0} def mxmax {2.5} def mymin {0} def ydash {0} def mymax {2} def mzmin {0} def zdash {0} def mzmax {2}%x axis draw [破線]( mxmin、0,0 )-( xdash、0,0); draw [->、> =ラテックス]( xdash、0,0)-( mxmax、0,0)ノード[左] {$ x $}; %y軸 draw [破線](0、 mymin、0)-(0、 ydash、0); draw [->、> =ラテックス](0、 ydash、0)-(0、 mymax、0)ノード[右] {$ y $}; %z軸 draw [破線](0,0、 mzmin)-(0,0、 zdash); draw [->、> =ラテックス](0,0、 zdash)-(0,0、 mzmax)ノード[左] {$ z $}; %サーフェス1のドメイン draw( xa、0,0)-( xa、 xb、0); draw [破線](0,0,0)-( xa、 xb、0); draw({0.7 * xa}、{0.3 ^ xb}、0)ノード{$ D_1 $}; fill [color = fillbottom、opacity = 0.2](0,0,0)-( xa、0,0)-( xa、 xb、0)-サイクル; %サーフェス2のドメイン draw [dashed]( xa、 xb、0)-(0、 xb、0); draw({0.3 * xa}、{0.7 ^ xb}、0)ノード{$ D_2 $}; fill [color = fillbottom、opacity = 0.2](0,0,0)-(0、 xb、0)-( xa、 xb、0)-サイクル; %特殊点 node at( xa、 xb、0)[right] {$ y = x $}; node at( xa、0,0)[left] {$ xa $}; node at(0、 xb、0)[右上] {$ xb $}; %ヘルプライン draw [thick、dashed]( xa、 xb、0)-( xa、 xb、{g( xa、 xb)}); draw [thick、dashed](0、 xb、0)-(0、 xb、{g(0、 xb)}); %サーフェス1:z = xy draw [thick、draw = curvecolor、fill = filltop、opacity = 0.4](0,0,0)-plot [domain = 0: xa、samples = 50、smooth]({ x}、{ x}、{f( x、 x)})-plot [variable = y、domain = xb:0、samples = 50、smooth](1、{ y}、 {f(1、 y)})-plot [domain = xa:0、samples = 50、smooth]( x、{0}、{f( x、0)})-cycle; %サーフェス1:メッシュライン foreach k in {0.1、0.2、...、0.9} { draw [meshcolor] plot [domain = 0: xa、samples = 50、smooth]( x、{ k * x}、{f( x、{ k * x})}); }%サーフェス2:z = x ^ 2 + y ^ 2 filldraw [thick、draw = curvecolor、fill = filltop、opacity = 0.4](0,0,0)-plot [domain = 0: xa、samples = 50、smooth]({ x}、{ x}、{g( x、 x)})-plot [domain = xa:0、samples = 50、smooth]({ x}、 {1}、{g( x、1)})-plot [variable = y、domain = xb:0、samples = 50、smooth]({0}、{ y}、{g(0 、 y)})-cycle; %サーフェス2:メッシュライン foreach k in {0.1、0.2、...、0.9} { draw [meshcolor] plot [variable = y、domain = 0: xb、samples = 50、smooth]({ k * y}、 y、{g( k * y、 y)}); }%====================== end {tikzpicture} end {document}