채택된 답변

Sam Chak
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

Muhammad
Muhammad 2023년 12월 12일
편집: Muhammad 2023년 12월 12일
is your approach/method remain same, if we obtain a sol like this: sol = ode45(@odefun,tspan,y0)?
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
Name Size Bytes Class Attributes t 73x1 584 double y 73x2 1168 double
%% 'sol' Method
sol = ode45(odefun, tspan, y0);
t = linspace(0, 10, 73)';
y = deval(sol, t)';
whos t y sol
Name Size Bytes Class Attributes sol 1x1 5178 struct t 73x1 584 double y 73x2 1168 double
Thank you for your help

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

추가 답변 (1개)

Jalal Khan
Jalal Khan 2023년 12월 12일

0 개 추천

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

댓글 수: 1

like if we are dealing with differential equations for ODE case lorenz equation and DDE mackey glass equation

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

카테고리

질문:

2023년 12월 12일

댓글:

2023년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by