How run the code including wiener process function

39 Ansichten (letzte 30 Tage)
salim saeed
salim saeed am 14 Dez. 2024 um 9:02
Kommentiert: Cris LaPierre am 16 Dez. 2024 um 3:28
I understand the code, but I'm not sure what the mistake is or why the Wiener function is causing a problem for me. Did I define something incorrectly? When I remove the Wiener term, the code works, but it must be included.
clc;
clear;
% Parameters
n = 1;
A = 1; % Amplitude
B = 1; % Width parameter of soliton
v = 1; % Velocity of soliton
alpha = 1; % Nonlinearity parameter
beta = 0.1; % Dispersion parameter
gamma = 0.05; % Noise intensity for multiplicative noise
% Grid for xi and time
xi = linspace(-20, 20, 2000); % Spatial range in transformed coordinates
t = linspace(0, 20, 1000); % Time range
dt = t(2) - t(1); % Time step
% Define initial soliton profile (deterministic solution)
u_deterministic = abs(((tanh(0.192e3 ./ 0.35e2 .* t' + xi) - 0.1e1) .^ (0.1e1 ./ 0.4e1)) .* exp(i * (-0.3e1 .* xi - 0.8e1 * t' + (3 .* w(t) ))));
Unrecognized function or variable 'w'.
% Ensure u_deterministic has the correct dimensions (time x space)
if size(u_deterministic, 1) ~= length(t) || size(u_deterministic, 2) ~= length(xi)
error('Mismatch in dimensions of u_deterministic. Check calculations.');
end
% Initialize storage for the stochastic solution
u_stochastic = zeros(length(t), length(xi));
% Generate Wiener process (increments) for time
W = cumsum(sqrt(dt) * randn(size(t))); % Wiener process for each time step
W = gamma * W; % Scale Wiener process by gamma
% Time evolution
for n = 1:length(t)
% Apply the Wiener noise factor at time step n
noise_factor = 1 + W(n);
% Update solution with multiplicative noise
u_stochastic(n, :) = u_deterministic(n, :) * noise_factor;
end
% Plot the 3D surface of the stochastic Kudryashov soliton
figure;
surf(xi, t, u_stochastic, 'EdgeColor', 'none');
xlabel('Transformed Space (\xi)');
ylabel('Time (t)');
zlabel('Amplitude (u)');
title('Stochastic Kudryashov Soliton Solution with Multiplicative Noise (Wiener Process)');
colormap jet;
colorbar;

Antworten (1)

Cris LaPierre
Cris LaPierre am 14 Dez. 2024 um 15:10
You use a function - w(t) - that you do not define in your code. At least that is the error I get in this line:
u_deterministic = abs(((tanh(0.192e3 ./ 0.35e2 .* t' + xi) - 0.1e1) .^ (0.1e1 ./ 0.4e1)) .* exp(i * (-0.3e1 .* xi - 0.8e1 * t' + (3 .* w(t) ))));
Assuming that is the wiener term you are referring to, what is it? It needs to be defined, too.
  6 Kommentare
salim saeed
salim saeed am 15 Dez. 2024 um 9:07
Bearbeitet: salim saeed am 15 Dez. 2024 um 9:10
@Cris LaPierre in begin i run don't have issue but now he give me erro which is
Warning: Error updating AxesLayoutManager.
Limits are too large.
Limits are too large.
Limits are too large.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by