How run the code including wiener process function

조회 수: 8 (최근 30일)
salim
salim 2024년 12월 14일
댓글: Cris LaPierre 2024년 12월 16일
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;

답변 (1개)

Cris LaPierre
Cris LaPierre 2024년 12월 14일
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
salim
salim 2024년 12월 15일
편집: salim 2024년 12월 15일
@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.

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

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by