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

4 vues (au cours des 30 derniers jours)
Ramneet Sidhu
Ramneet Sidhu le 14 Nov 2019
Commenté : Muhammad Usman le 14 Nov 2019
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);

Réponse acceptée

Muhammad Usman
Muhammad Usman le 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
  2 commentaires
Ramneet Sidhu
Ramneet Sidhu le 14 Nov 2019
It worked!! Thankyou so much.
Muhammad Usman
Muhammad Usman le 14 Nov 2019
Welcome

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by