What is wrong with the following code using ezplot?

1 回表示 (過去 30 日間)
Arvind Ganesh
Arvind Ganesh 2017 年 2 月 16 日
回答済み: Star Strider 2017 年 2 月 16 日
syms u v
x= u^2+sin(v);
y= tan(v);
z= 1/(tan(u)+sin(v));
ezplot(@(u,v)tan(x)+y+sin(z)==0)
% I want a 2D plot of u and v from the parametrized equation.

回答 (1 件)

Star Strider
Star Strider 2017 年 2 月 16 日
You have a two-variable equation. The ezplot and fplot functions plot one-variable equations. You have to change your function definitions and your function call in the ezcoutour or fcontour (or other mesh or surface plot):
syms u v
x = symfun(u^2+sin(v), [u,v]);
y = symfun(tan(v), v);
z = symfun(1/(tan(u)+sin(v)), [u,v]);
fcontour(@(u,v)tan(x(u,v))+y(v)+sin(z(u,v)))
This code works (and will work with ezcontour or fcontour with R2012a and later). However, the fcontour (and ezcontour) call throws this error:
Warning: Error updating FunctionContour.
Division by zero.
and produces no plot. I will let your sort that out.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by