Matlab don't show calculated variables.
Mostra commenti meno recenti
I wrote this:
syms C0 C1 C2 C3 X L P EI1 EI2
Y(X)=C0+C1*X+C2*X^2+C3*X^3;
dY(X)=diff(Y(X),X);
d2Y(X)=diff(dY(X),X);
f0 = Y(0) == 0;
f1 = Y(L) == 0;
R=solve([f0,f1],[C0,C1]);
C0 = R.C0;
C1 = R.C1;
U=(EI1/2)*int(d2Y(X)^2,[0 L/2])+(EI2/2)*int(d2Y(X)^2,[L/2 L]);
V=-P*Y(L/2);
PI(C2,C3)=U+V;
dPIdC2=diff(PI(C2,C3),C2);
dPIdC3=diff(PI(C2,C3),C3);
f2 = dPIdC2 == 0;
f3 = dPIdC3 == 0;
S=solve([f2,f3],[C2,C3]);
C2 = S.C2;
C3 = S.C3;
C= ([C0;C1;C2;C3]);
disp(C);
Y(X)=C0+C1*X+C2*X^2+C3*X^3;
disp Y(X);
disp (Y(X));
FLECHA = Y(L/2)
But Matlab returns:
C =
0
- C3*L^2 - C2*L
(P*(EI1*L + 11*EI2*L))/(4*(EI1^2 + 14*EI1*EI2 + EI2^2))
-(P*(EI1 + 7*EI2))/(6*(EI1^2 + 14*EI1*EI2 + EI2^2))
______________________________________________
Y(X)
C3*X^3 + C2*X^2 + C1*X + C0
FLECHA
(C3*L^3)/8 + (C2*L^2)/4 + (C1*L)/2 + C0
It dont show Y(X) in terms of calculated values of C0, C1, C2 and C3.
I Want the Y(x) in function of P, L, EI1, EI2, (...), with this script these variables C0, C1... are calculateds but MATLAB dont write Y(X) em terms of them.
Risposta accettata
Più risposte (1)
I get a dfifferent output than you:
syms C0 C1 C2 C3 X L P EI1 EI2
Y(X)=C0+C1*X+C2*X^2+C3*X^3;
dY(X)=diff(Y(X),X);
d2Y(X)=diff(dY(X),X);
f0 = Y(0) == 0;
f1 = Y(L) == 0;
R=solve([f0,f1],[C0,C1]);
C0 = R.C0;
C1 = R.C1;
U=(EI1/2)*int(d2Y(X)^2,[0 L/2])+(EI2/2)*int(d2Y(X)^2,[L/2 L]);
V=-P*Y(L/2);
PI(C2,C3)=U+V;
dPIdC2=diff(PI(C2,C3),C2);
dPIdC3=diff(PI(C2,C3),C3);
f2 = dPIdC2 == 0;
f3 = dPIdC3 == 0;
S=solve([f2,f3],[C2,C3]);
C2 = S.C2;
C3 = S.C3;
C= ([C0;C1;C2;C3]);
disp(C);
Y(X)=C0+C1*X+C2*X^2+C3*X^3;
disp Y(X);
disp (Y(X));
FLECHA = Y(L/2)
1 Commento
Tiago Araujo
il 14 Apr 2021
Categorie
Scopri di più su Clocks and Timers in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

