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

4 ビュー (過去 30 日間)
Ramneet Sidhu
Ramneet Sidhu 2019 年 11 月 14 日
コメント済み: Muhammad Usman 2019 年 11 月 14 日
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);

採用された回答

Muhammad Usman
Muhammad Usman 2019 年 11 月 14 日
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
  2 件のコメント
Ramneet Sidhu
Ramneet Sidhu 2019 年 11 月 14 日
It worked!! Thankyou so much.
Muhammad Usman
Muhammad Usman 2019 年 11 月 14 日
Welcome

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by