Meshgrid fo variables in complex equation

10 ビュー (過去 30 日間)
HSIUYUAN WANG
HSIUYUAN WANG 2021 年 4 月 15 日
コメント済み: HSIUYUAN WANG 2021 年 4 月 16 日
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;
answer=solve(f);
answer2(i)=answer;
x1(i)=x;
y1(i)=y;
i=i+1;
end
end
answer3=double(answer2);
[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
Stephan 2021 年 4 月 15 日
編集済み: Stephan 2021 年 4 月 15 日
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)
  3 件のコメント
Stephan
Stephan 2021 年 4 月 15 日
HSIUYUAN WANG
HSIUYUAN WANG 2021 年 4 月 16 日
I'll try that later, thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by