adding noise to the solution obtained from ode45/dde23
5 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Sam Chak
2023 年 12 月 12 日
Does it work if you execute the following?
[t, y] = ode45(@odefun, tspan, y0);
noise = mynoise(t); % user-defined math function for noise
ynoise = y + noise; % additive method
3 件のコメント
Sam Chak
2023 年 12 月 13 日
Hi @Muhammad
In theory, the approach remains the same. You store the ode45 solution in sol as a structure array, and then you need to evaluate the structure at n points in the interval
to obtain the data y.
%% ODE
odefun = @(t, y) [y(2); - y(1) - 2*y(2)];
tspan = [0 10];
y0 = [1; 0];
%% Direct Method
[t, y] = ode45(odefun, tspan, y0);
whos t y
%% 'sol' Method
sol = ode45(odefun, tspan, y0);
t = linspace(0, 10, 73)';
y = deval(sol, t)';
whos t y sol
その他の回答 (1 件)
Jalal Khan
2023 年 12 月 12 日
The best way to add noise to the solution obtained from solvers like ode45 or dde23 depends on the specific requirements of your problem and the characteristics of the noise you want to introduce
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!