surf in triangle are / inpolygon - triangular ?
Show older comments
hi i need some help for surffing in a restricted are such as triangle. i need to surf an equaion like this inside of a triangle area. (2076395481264383616492724694233*x^2)/13846124950206145632821785814630400000 + (11526310362537213*x*y)/57646075230342348800000 + (22148802965162135097748811617637*x)/830767497012368737969307148877824000 + (3842103454179071*y^2)/57646075230342348800000 - (3842103454179071*y)/2305843009213693952000
first i tried ezsurf but i couldnt plot in a restricted area. then i tried to meshgrid (x,y) in small rectangular area, then i used inpolygon function. but the result is not in a triangle are. it will be in a rectangular area. i dont know how to define triangle area by this function X coordinates of triangle are for example: X1 X2 X3 and Y coordinate is Y1,Y2,Y3
i tried this code but its not right nnx = (xmax - xmin) / 10; nny = (ymax - ymin) / 10; xx= xmin:nnx:xmax; yy= ymin:nny:ymax;
oneTriangleX = [XRANGE(1), XRANGE(2), XRANGE(3)];
oneTriangleY = [YRANGE( 1), YRANGE(2), YRANGE(3)];
isin=inpolygon(xx ,yy , oneTriangleX, oneTriangleY);
Xin = xx(isin);
Yin = yy(isin);
[X,Y]=meshgrid(Xin,Yin);
syms x y
G1 = subs(plate_eq(i), [x y], {X,Y});
G1 = double(G1);
surf(X , Y , G1)
so the question is how can i surf an equation in a triangle restricted area, and how can i define the edge of this restricted area.
if U dont know how, this is my second question. we can use inpolygon function to find those points which are in an area, but how can i define the triangle area. should i use the meshgrid after inpolygon or befor that?
by the way i have many of these triangles and functions to surf inside of them.
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!