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

Antworten (2)

Steven Lord
Steven Lord am 25 Okt. 2019

0 Stimmen

Call coeffs with two output arguments.
>> [C, T] = coeffs(lhs(eqn1), [C11 C12 C13 C14])
atabak mostafavi
atabak mostafavi am 30 Okt. 2019

0 Stimmen

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?

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 25 Okt. 2019

Beantwortet:

am 30 Okt. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by