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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Assumptions 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by