# Meshgrid fo variables in complex equation

16 views (last 30 days)
HSIUYUAN WANG on 15 Apr 2021
Commented: HSIUYUAN WANG on 16 Apr 2021
I have an equation that have three variables
The equation is like this : f(x, y, z)=2x+3y+4z=0
But the equation I really want to use is more complex that I can’t turn it into
z=(-3y-2x)/4 format like this
And I want to draw a plot about the relation between the three(x, y, z) when
x = 3: 1:6; (3,4,5,6)
y = 5: 1:9; (5,6,7,8,9)
I know that if I can turn the equation into z=(-3y-2x)/4 format, I can do that using
x=3:1:6;
y=5:1:9;
[xx,yy]=meshgrid(x,y);
zz=(-3.*yy-2.*xx)/4;
mesh(xx,yy,zz);
But because the equation I really want to use is too complex, I can’t use the method to get the answer I want
I also try the other way using for loop
i=1
for x= 3:1:6
for y= 5:1:9
syms f(z)
f=2*x+3*y+4*z;
x1(i)=x;
y1(i)=y;
i=i+1;
end
end
[x2,y2]=meshgrid(x1,y1);
But still don’t know the next process
Can I have other methods to use, or can I revise the methods above to solve my problem?
I am new to matlab, and i really need your help, thank you!

Stephan on 15 Apr 2021
Edited: Stephan on 15 Apr 2021
You might want to try fimplicit3:
syms f(x,y,z)
f(x, y, z)=2*x+3*y+4*z==0
f(x, y, z) =
fimplicit3(f)
or an even more complex example:
f(x, y, z)=2*sin(x)+tanh(3*y)+exp(z/4)==0
f(x, y, z) =
fimplicit3(f)
HSIUYUAN WANG on 16 Apr 2021
I'll try that later, thank you very much!

### Categories

Find more on Number Theory 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!

Translated by