フィルターのクリア

Error using dsolve, System of differential Equations

1 回表示 (過去 30 日間)
Devansh Saxena
Devansh Saxena 2019 年 9 月 10 日
回答済み: Vidip 2024 年 4 月 12 日
Error:
Warning: Unable to find explicit solution.
> In dsolve (line 201)
In Nose_Differentiation (line 18)
Error using sym/subsindex (line 814)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function
arguments must be symbolic variables, and function body must be sym expression.
Error in Nose_Differentiation (line 18)
[xSol(t), ySol(t), zSol(t)] = dsolve(odes,conds);
Code:
clear;
syms x(t) y(t) z(t);
cond1 = x(0) == 0;
cond2 = y(0) == 2;
cond3 = z(0) == 0;
conds = [cond1; cond2; cond3];
ode1 = diff(x) == y;
ode2 = diff(y) == -1*x + y*z;
ode3 = diff(z) == x*x - 4*y*y - 1;
odes = [ode1; ode2; ode3];
[xSol(t), ySol(t), zSol(t)] = dsolve(odes,conds);

回答 (1 件)

Vidip
Vidip 2024 年 4 月 12 日
The error you're encountering arises from attempting to assign the output of ‘dsolve’ directly to function handles in a way that MATLAB doesn't support. When solving for multiple functions, ‘dsolve’ returns a structure by default. Alternatively, you can assign solutions to functions or variables directly by explicitly specifying the outputs as a vector where the ‘dsolve’ function only expects the equations to be passed as an input argument. You can refer to the below documentation link to get more information-

カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by