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

조회 수: 2 (최근 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 CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by