How do i use boundary conditions to find variables in an equation

1 view (last 30 days)
Hi all. I am trying to find 4 variables which are c1, c2, c3, c4 in my equation using 4 boundary conditions. The value of lambda is known. But i donot know how to proceed. Any help is much appreciated.
My code is as follows:
lambda = 0.0275;
%Solution of the governing equation for beam-on-elastic-foundation is:
syms x c1 c2 c3 c4
u(x) = exp(lambda*x)*(c1*cos(lambda*x) + c2*sin(lambda*x)) +exp(-lambda*x)*(c3*cos(lambda*x) + c4*sin(lambda*x));
du(x) = diff(u,x);
%The boundary condition for the pile under node 01 on applying unit force on dof-01 is:
eqn1 = u(0)==1;
eqn2 = u(Lp)==0;
eqn3 = du(0)==0;
eqn4 = du(Lp)==0;
eqns = [eqn1 eqn2 eqn3 eqn4];
vars = [C1 C2 C3 C4];
soln = solve(u,eqns,vars);

Accepted Answer

Muhammad Usman
Muhammad Usman on 14 Nov 2019
if you let Lp=constant and make changes in
soln = solve(u,eqns,vars);
to
soln = solve(eqns);
you will get a structure soln and in the command window you can access the value for each variable by soln.[variable], for example soln.c1

More Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!