How do you add white noise to a nonlinear ODE?
Show older comments
I have the following system of differential equations and am trying to add GWN to the input.
f = @(t,y) [alpha * (y(2) + y(1) - (y(1).^3)/3 + ( k1 + c * y(3)+ x));
(-1/alpha) * (w2 * y(1) - a + b * y(2));
alpha * (y(4) + y(3) -( y(3).^3)/3 + (k2 + c * y(1)));
(-1/alpha) * (w2 * y(3) - a + b * y(4)) ];
[T Y] = ode15s(f, [0 1000], [0, 0, 0, 0]);
The input is in bold and the noise is represented by the x. The noise is bandlimited and was created as follows:
% Generate Gaussian White Noise
gwn = wgn(N,1,20);
% create butterworth filter
Wn = 5/(fs/2); %cutoff frequency
[b, a] = butter(4,Wn, 'low'); % get filter coefficients
w = filter(b,a,gwn); % apply filter
However, when I try to add this to my ode, I get the following error:
Error in ==> odearguments at 98 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode15s at 227 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> Main_ImR at 29 [T Y] = ode15s(f, [0 1000], [0, 0, 0, 0]);
In this case,
a = 0.7; b = 0.8; w2 = 1; alpha = 3; k1 = -1; k2 = -1; c = 0.5;
Why am I getting this error and how would I go about adding the noise to the ode?
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!