필터 지우기
필터 지우기

Matlab 2024a giving the wrong Jacobian

조회 수: 9 (최근 30일)
Gökhan
Gökhan 2024년 6월 5일
편집: Torsten 2024년 6월 6일
if I run the below code in MATLAB 2024a, jacobian is zero. However, this is wrong.
If I use "clear" instead of "clear all", the answer is correct. However, in 2023b in both cases (clear or clear all) I get the correct answer?
is this a bug? or what is the point?
clear all
clc
syms x y r
dy1 = x
dy2 = y
dr = r;
F=[dy1;dy2;dr]
% equilibrium_points = solve(F == 0, [x, y, r]);
% equilibrium_points = ...,
% [equilibrium_points.x, equilibrium_points.y, equilibrium_points.r];
J=jacobian(F,[x y r])

답변 (1개)

Aneela
Aneela 2024년 6월 5일
Hi Gokhan,
I have tried this code in R2024a, it is working fine.
clear all
clc
syms a b c d m n s r x y k
dy1 = -x*( r*x.^2 - r*(a+b)*x + a*b +(c*y-r*d));
dy2 = s + m*x-n*y ;
dr = r-x;
F=[dy1;dy2;dr]
F = 
% equilibrium_points = solve(F == 0, [x, y, r]);
% equilibrium_points = ...,
% [equilibrium_points.x, equilibrium_points.y, equilibrium_points.r];
J=jacobian(F,[x y r])
J = 
“clear” – Removes variables from the workspace, but does not clear functions, global variables, or MEX files from the memory.
“clear all” – Removes all variables, functions, and MEX files from the memory, resetting MATLAB to a clean state.
Use the following command to know if there are multiple variables defined with same name at different locations:
which J -all
J is a variable.
  댓글 수: 2
Gökhan
Gökhan 2024년 6월 6일
which J -all
gives " J is a variable".
When I start the MATALB, at first run, (F5) the code gives the correct answer. At subsequent runs, it gives zero.
I tried it online, and always (subsequent) runs, it gives correct answer.
I think, it is something in my matlab in the computer.
Torsten
Torsten 2024년 6월 6일
편집: Torsten 2024년 6월 6일
I remember a request a few days ago where a similar phenomenon occured together with the symbolic toolbox, and the same remedy (use of only "clear" instead of "clear all") was suggested by the support center. So it seems it is a known bug.
To be sure, contact TMW:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by