Solving boundary value problem

조회 수: 3 (최근 30일)
Sumit
Sumit 2025년 7월 16일
편집: Torsten 2025년 7월 17일
Hi,
I am trying to solve the following differential equation in MATLAB and obtain tau-c vs x curve when Beta^2= 0.048. My code is attached at the end of the snapshot. I am getting error when I introduce the integration boundary condition.
Any sort of help or guidance is highly appreciated.
Thanks.

답변 (1개)

Torsten
Torsten 2025년 7월 16일
편집: Torsten 2025년 7월 16일
I think this is what you want. But although there are four boundary conditions for four free parameters, they do not suffice to fix a unique solution. Thus there must be an additional condition missing.
syms To(x) Ti(x) tau(x)
syms beta c tau_avg
% Define ODE system and boundary conditions
eqns = [diff(To,x)+tau==0,diff(Ti,x)-2*tau==0,diff(tau,x,2)-beta^2*tau==0];
conds = [To(-c) == 2*c*tau_avg,Ti(-c) == 0, To(c) == 0, Ti(c) == 4*c*tau_avg];
% Compute solution of ODE system with boundary conditions
sol = dsolve(eqns,conds);
sol_tau = simplify(sol.tau)
sol_tau = 
% Write solution for tau in basis functions sinh(beta*x) and cosh(beta*x)
syms A B
eqn = sol_tau == A*sinh(beta*x)+B*cosh(beta*x);
coeffs = solve([subs(eqn,x,c),subs(eqn,x,-c)],[A,B]);
coeffs.A = simplify(coeffs.A);
coeffs.B = simplify(coeffs.B);
sol_tau = coeffs.A*sinh(beta*x) + coeffs.B*cosh(beta*x)
sol_tau = 
v4 = symvar(sol_tau)
v4 = 
% Choose numerical values for beta, tau_avg, c and the free paramter C1 and substitute
% in solution for tau
beta_num = sqrt(0.048);
tau_avg_num = 0.25;
c_num = 1;
C1_num = 0;
sol_tau_num = subs(sol_tau,[beta tau_avg c v4(1)],[beta_num tau_avg_num c_num C1_num])
sol_tau_num = 
% Plot solution for tau
fplot(sol_tau_num,[-c_num c_num]) % plot tau_c
  댓글 수: 3
Torsten
Torsten 2025년 7월 16일
편집: Torsten 2025년 7월 17일
The above code gives the correct answer for the constant B in formula (26), but do you know how formula (25) for A is deduced in the article ?
I spent quite a lot of time on it, but couldn't find a solution.
Torsten
Torsten 2025년 7월 17일
편집: Torsten 2025년 7월 17일
Maybe you couldn't understand it from the code: the conditions
T(-c)==0, T(c)==2*c*tau_avg
for the newly defined function T implement
integral_{-c}^{c} tau(x) dx = T(c) - T(-c) = 2*c*tau_avg - 0 = 2*c*tau_avg
, thus the boundary condition you want to set.
syms tau(x) T(x)
syms beta tau_avg c
eqns = [diff(tau,x,2)-beta^2*tau==0,diff(T,x)-tau==0];
conds = [T(-c)==0,T(c)==2*c*tau_avg];
sol = dsolve(eqns,conds)
sol = struct with fields:
T: (C1*exp(-beta*x))/beta^2 - (C1*exp(2*beta*c) - C1*exp(-2*beta*c) + 2*beta^2*c*tau_avg*exp(-beta*c))/(beta^2*(exp(beta*c) - exp(-beta*c))) + (exp(beta*x)*(C1*exp(beta*c) … tau: (exp(beta*x)*(C1*exp(beta*c) - C1*exp(-beta*c) + 2*beta^2*c*tau_avg))/(beta*(exp(beta*c) - exp(-beta*c))) - (C1*exp(-beta*x))/beta
simplify(sol.tau)
ans = 

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

카테고리

Help CenterFile Exchange에서 Equation Solving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by