Bahram
Bahram

Reputation: 87

solving differential equation using matlab

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...

enter image description here

Upvotes: 0

Views: 203

Answers (1)

Mansour Torabi
Mansour Torabi

Reputation: 421

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}) 

Upvotes: 1

Related Questions