matlab re-orders my equation
1 view (last 30 days)
Show older comments
hi guys
so am trying to get coefficient of an eqtion in matlab but matlab keeps changing the order of terms after defining the equation or making a derivetive of it:
Phi1=C11*sin(Alpha1*X1)+C12*cos(Alpha1*X1)+C13*sinh(Alpha1*X1)+C14*cosh(Alpha1*X1);
eqn1= Phi1==0;
eqn2=diff(Phi,X1)==0;
since order of the C11, C12, C13, C14 coefficents changes in the above equation below line does not work:
coeffs(lhs(eqn1),[C11 C12 C13 C14])
and one more thing, how can I put zero insted of the coefficents which are not exist, for example if I replace X1 with zero then I want to get :
[0 1 0 1] insted of [1 1]
thanks a lot
0 Comments
Answers (2)
Steven Lord
on 25 Oct 2019
Call coeffs with two output arguments.
>> [C, T] = coeffs(lhs(eqn1), [C11 C12 C13 C14])
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!