Borrar filtros
Borrar filtros

how to change U(0,t) = 1 to Ux(0,t) = 1

1 visualización (últimos 30 días)
Omar Benavente
Omar Benavente el 10 de Feb. de 2022
Respondida: Shushant el 26 de Sept. de 2023
a = @(t) 1;
b = @(t) 1;
xArray = dx*(0:J);
tArray = dt*(0:N);
for n = 1 : N
u(1, n+1)=a(tArray(n+1)); % Boundary Conditions at x=0
u(J+1, n+1)=b(tArray(n+1)); % Boundary Conditions at x=1
for j = 2 : J
u(j, n+1) = u(j,n) + mu*(u(j+1,n) - 2*u(j,n) + u(j-1,n));
end
end
I have the two boundaries of u(0,t) = 1and u(1,t), What if I change the boundary condition u(0,t) =1 to ux(0,t) = 1(differentiate with respect to x). How do I change my boundary condition to ux(0,t) = 1 according to my code?
Sincerely yours,
Omar

Respuestas (1)

Shushant
Shushant el 26 de Sept. de 2023
Hi Omar Benavente,
I understand that you have an equation "u(0,t) = 1" and you want to differentiate this equation with respect to "x" to obtain "ux(0,t)".
To define an equation in terms of "x", you need to first make "x" a symbolic object. Refer to the following documentation for more information on "syms" and how to make a variable into a symbolic object-
Then you have to define "u(0,t)" in terms of the symbolic object "x". Afterwards, you can use the "diff" function to differentiate "u(0,t)" to obtain "ux(0,t)". Refer to the following documentation for more information on how to use "diff" function with symbolic objects-
I hope this helped in solving the issue you were facing.
Thank you,
Shushant

Categorías

Más información sobre Assembly en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by