matlab re-orders my equation

3 visualizaciones (últimos 30 días)
atabak mostafavi
atabak mostafavi el 25 de Oct. de 2019
Respondida: atabak mostafavi el 30 de Oct. de 2019
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

Respuestas (2)

Steven Lord
Steven Lord el 25 de Oct. de 2019
Call coeffs with two output arguments.
>> [C, T] = coeffs(lhs(eqn1), [C11 C12 C13 C14])

atabak mostafavi
atabak mostafavi el 30 de Oct. de 2019
thank you for your answer steven, however my problem is more related to the displaying the equation becuse matlab re-orders the equation as it wants. so how can i keep the order for example after derivative?

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by