"Second argument must be of form 'x' or 'x = a..b'." with fcontour

4 ビュー (過去 30 日間)
Mateus Moneta
Mateus Moneta 2023 年 4 月 17 日
編集済み: Praveen Reddy 2023 年 5 月 11 日
Hello everyone,
I have an equation to integrate with Symbolic tools that works just fine until I have to plot its contour(fsurface works correctly). I get the message "Second argument must be of form 'x' or 'x = a..b'."
It is weird because I have other equations in the same code that are also plotted correctly with fcontour. I investigated and concluded that problem occurs because a step in my equation.
I have Syms T x y u and my equation contains the following part: T = int(u*(exp(x+y/u)), integration only in u....if I remove the u from the exponential part, then fcontour works,(T = int(u*(exp(x+y)) but of course with the wrong equation. Any idea why it happens?
This picture is the fsurface of the fucntion that is returning me this error with fcontour.
thhose two are from the modified equation that works
  2 件のコメント
Matt J
Matt J 2023 年 4 月 17 日
I get the message "Second argument must be of form 'x' or 'x = a..b'."
From what code?
Mateus Moneta
Mateus Moneta 2023 年 4 月 18 日
Hello,
the following code returns me this error. If I remove the "u" variable from the exp, then fcontour works.
Fsurf works with both.
syms tau x y u
tau = 500000*int((sqrt(u)*(u+0.5))^-1*(exp(-(x.^2 + y.^2)/(4*(0.5 + u)))),u,0,10)
figure
fcontour(tau, [-25 0 -25 25])

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

回答 (1 件)

Praveen Reddy
Praveen Reddy 2023 年 5 月 11 日
編集済み: Praveen Reddy 2023 年 5 月 11 日
Hi Mateus,
I understand that you are trying to plot contour using “fcontour” function and encountering the error message "Second argument must be of form 'x' or 'x = a..b' ”.The "fcontour(f,xyinterval)" function expects “f” to be a function handle. I could observe that you are using symbolic expression instead of function handle. I suggest you to convert the symbolic expression to function handle while passing it to “fcontour” function as shown below using “matlabFunction”.
syms tau x y u
tau = 500000*int((sqrt(u)*(u+0.5))^-1*(exp(-(x^2 + y.^2)/(4*(0.5 + u)))),u,0,10)
figure
fcontour(matlabFunction(tau), [-25 0 -25 25])
To know more about “matlabFunction” and input arguments to “fcontour”, please refer the following MATLAB documentation:

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by