Re: triangles
- To: mathgroup at smc.vnet.net
- Subject: [mg39285] Re: triangles
- From: "Peltio" <peltio at twilight.zone>
- Date: Sun, 9 Feb 2003 04:50:39 -0500 (EST)
- References: <b1ag0j$ph6$1@smc.vnet.net>
- Reply-to: "Peltio" <peltioNOSP at Miname.com.invalid>
- Sender: owner-wri-mathgroup at wolfram.com
"Karen A. Wilk" ha scritto >Hi! Does anyone know what two 2-dimensional triangles multiplied >together look like? Has this something to do with fuzzy logic? Just wondering. Here are a few piecewise linear constructors (they were intended for membership functions, that's what the MF stands for): GammaShapedMF[x_, a_, b_] := Which[x<=a, 0, a <x< b, 1+(x-b)/(b-a),x>=b, 1] LShapedMF[x_, a_, b_] := Which[x<=a, 1, a<x<b, 1-(x-a)/(b-a), x>=b, 0] PiShapedMF[x_, a_, c1_, c2_, b_] := Min[GammaShapedMF[x, a, c1], LShapedMF[x, c2, b]] DeltaShapedMF[x_, a_, c_, b_] := Min[GammaShapedMF[x, a, c], LShapedMF[x, c, b]] Once you defined your triangular functions by means of a Which statement, say tri1[x_]:=DeltaShapedMF[x,2,4,6] tri2[y_]:=DeltaShapedMF[y,1,3,5] and once you chose the algebraic multiplication as the operator that multiplies them together, I suppose that by plotting the function f[x_,y_]=tri1[x]*tri2[y]; you'll find a cute pyramid. Here's a plot with a color function I like LimitedGrayLevel[x_, maxBk_:0.3, maxWh_:0.90] := GrayLevel[maxBk + x(maxWh - maxBk)] FuzzyGray[x_] := LimitedGrayLevel[1 - x, 0, .9] Plot3D[ f[x,y], {x,0,8}, {y,0,8}, PlotPoints->25, BoxRatios->{1,1,1}, ColorFunction->FuzzyGray, PlotRange->All ] Sigmoidal and gaussian MF make better plots, though : ) cheers, Peltio invalid address in reply, demunging required to mail me