フィルターのクリア

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 Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by