Convert ezmesh to fmesh

2 views (last 30 days)
CL
CL on 9 Dec 2021
Commented: KSSV on 10 Dec 2021
I have an old piece of code that uses ezmesh:
h=ezmesh(@(x,y)v1(1)*x+v2(1)*y,... % funx
@(x,y)v1(2)*x+v2(2)*y,... % funy
@(x,y)v1(3)*x+v2(3)*y,... % funz
[-1 1 -1 1 -1 1]); % interval
In version R2021b, the editor prompts a warning that says:
'ezmesh' is not recommended. With appropriate code changes, use 'fmesh' instead
But after I convert ezmesh to fmesh:
h=fmesh(@(x,y)v1(1)*x+v2(1)*y,... % function of x
@(x,y)v1(2)*x+v2(2)*y,... % function of y
@(x,y)v1(3)*x+v2(3)*y,... % function of z
[-1 1 -1 1 -1 1]); % interval
I get the following warning:
Error using fsurf (line xxx)
Invalid parameter '-1 1 -...'.
Error in fmesh (line xxx)
h = fsurf(varargin{:}, 'CalledForMesh');
Error in xxx (line xxx)
h=fmesh(@(x,y)v1(1)*x+v2(1)*y,... % function of x
Can someone help explain what the problem is?

Answers (1)

KSSV
KSSV on 9 Dec 2021
Edited: KSSV on 10 Dec 2021
v1 = rand(3,1) ;
v2 = rand(3,1) ;
h=fmesh(@(x,y)v1(1)*x+v2(1)*y,... % funx
@(x,y)v1(2)*x+v2(2)*y,... % funy
@(x,y)v1(3)*x+v2(3)*y,... % funz
[-1 1 -1 1]); % interval
  2 Comments
CL
CL on 10 Dec 2021
sorry I'm not getting this. Why did you only specify one inteval [-1,1] for x-axis and ignoreing y- and z-axis? In the image shown, x's axis has [-0.4,0.4], y's axis has [-0.5,0.5] and z's [-1.3,1.3] ... none of the axis shown inteval of [-1,1].
KSSV
KSSV on 10 Dec 2021
You can specify the intervel for x and y. Edited the code.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!