what is the error is here?

3 ビュー (過去 30 日間)
Jignashu Gohel
Jignashu Gohel 2021 年 3 月 27 日
回答済み: Harshavardhan 2025 年 4 月 30 日
I have been computing a solution of second order linear ODE but at final answers shows the d solve error?
why it happen? i have enter right program then also shows error?
Here attach with Screenshot.

回答 (1 件)

Harshavardhan
Harshavardhan 2025 年 4 月 30 日
The error/warning has occurred as “dsolve” was unable to find a symbolic solution for the given differential equation.
As a workaround, a numerical solution can be obtained by using “ode45”. Here is an example code to solve the equation numerically for .
% Define the system as first-order equations
% Let y1 = y, y2 = y'
% Then, y1' = y2, y2' = -y1
f = @(t, Y) [Y(2); -Y(1)];
% Initial conditions
Y0 = [1; 0]; % y(0) = 1, y'(0) = 0
% Time span
tspan = [0 10];
% Solve using ode45
[t, Y] = ode45(f, tspan, Y0);
For more information on “dsolve” and ”ode45” you can type the following commands in a MATLAB command window.
doc dsolve
doc ode45
Hope this helps.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by