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

2 vues (au cours des 30 derniers jours)
Mateus Moneta
Mateus Moneta le 17 Avr 2023
Modifié(e) : Praveen Reddy le 11 Mai 2023
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 commentaires
Matt J
Matt J le 17 Avr 2023
I get the message "Second argument must be of form 'x' or 'x = a..b'."
From what code?
Mateus Moneta
Mateus Moneta le 18 Avr 2023
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])

Connectez-vous pour commenter.

Réponses (1)

Praveen Reddy
Praveen Reddy le 11 Mai 2023
Modifié(e) : Praveen Reddy le 11 Mai 2023
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:

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by