I have a question and just need you to tell me the steps I have to do. I have an equation with boundary conditions.the question is how can I find f(x)? I don't want to use the predefined Matlab.Please just show me the steps I need to solve this problem. Thanks...
Asked
Active
Viewed 137 times
0
-
1step 1 - read the chapter on 2nd order eq with boundary conditions https://www.stewartcalculus.com/data/CALCULUS%20Concepts%20and%20Contexts/upfiles/3c3-2ndOrderLinearEqns_Stu.pdf – dpdp Jan 14 '21 at 19:24
-
This is a linear DE, so in principle you can find the solution manually, and use Matlab to find the coefficients from the boundary conditions. – Lutz Lehmann Jan 14 '21 at 21:12
1 Answers
1
Simply you can use symbolic math toolbox in MATLAB:
syms f(x) % Define symbolic function
F = dsolve(diff(f,2) + diff(f,1) + 200*f == 0);
% Find C1 and C2 constants
syms C1 C2 L
BC_eq(1) = subs(F, x, 0) - 0;
BC_eq(2) = subs(F, x, L) - 100;
C_val = solve(BC_eq, [C1, C2]);
% Substitude C' values in F
F_final = subs(F, {C1, C2}, {C_val.C1, C_val.C2})

Mansour Torabi
- 411
- 2
- 6