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 Center および File ExchangeEquation Solving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by