In the “pdefun” function, you want to define “alpha1” and “alpha2” as functions of both time and space. You can achieve this by modifying the definition of “alpha1” and “alpha2” as follows:
alpha1 = 0.5*(1-sin(2*t1_interpolated)).*(1-sin(2*x));
alpha2 = 0.5*(1-sin(2*t1_interpolated)).*(1-sin(2*x));
This will make “alpha1” and “alpha2” functions of both t and x, and you can visualize the oscillations on both the time and space axes.
To observe oscillations on the spatial axis, you can modify the definition of “alpha1” and “alpha2” as follows:
alpha1 = 0.5*(1-sin(2*t1_interpolated)).*(1-sin(2*pi*x/10));
alpha2 = 0.5*(1-sin(2*t1_interpolated)).*(1-sin(2*pi*x/10));
This will make “alpha1” and “alpha2” functions of both t and x, and you can visualize the oscillations on both the time and space axes. The 2*pi*x/10 term in the definition of “alpha1” and “alpha2” introduces a sinusoidal variation in the spatial direction.
The x/10 term is used to normalize the spatial axis to the range [0,1].
The difference between using x and x/10 is that x represents the spatial axis in the original units, while x/10 represents the spatial axis normalized to the range [0,1]. Therefore, x/10 is used to normalize the spatial axis to the required range.
Here’s is the updated code,
function non_constant_spatial_and_temporal_axis
function [pl, ql, pr, qr] = pdebc(~, ~, ~, ~, ~)
function [c, f, s] = pdefun(x, ~, u, dudx)
t1=[1,0,3,4,5,3,2,3,2,3,3,2,3,4,5,6,7,5,4,3,3,2,2,1,3,2,4,5];
x_interpolate = linspace(0, 10, length(t1));
t1_interpolated = interp1(x_interpolate,t1,x,'linear');
alpha1 = 0.5*(1-sin(2*t1_interpolated)).*(1-sin(2*pi*x/10));
alpha2 = 0.5*(1-sin(2*t1_interpolated)).*(1-sin(2*pi*x/10));
s = [alpha1.*u(2).*(u(2).^2 -1); -alpha2.* u(1).*(u(2)-1)];
clear all; close all; clc;
sol = pdepe(m, @pdefun, @pdeic, @pdebc, x, t);
Hope this Helps!
Thanks.