Why is the word "and" coming up in my output?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to simplify an expression, but the word "and" keeps popping up in my result. When I try to work with this further, I get, "unexpected matlab expression." My script is:
syms A B C D p q r s t u;
y00 = cos(A + B + C + D);
y0 = expand(y00);
y1 = subs(y0,cos(A),(cosh(p)*cosh(q)-cosh(t)) / (sinh(p)*sinh(q)));
y2 = subs(y1,cos(B),(cosh(q)*cosh(r)-cosh(u)) / (sinh(q)*sinh(r)));
y3 = subs(y2,cos(C),(cosh(r)*cosh(s)-cosh(t)) / (sinh(r)*sinh(s)));
y4 = subs(y3,cos(D),(cosh(s)*cosh(p)-cosh(u)) / (sinh(s)*sinh(p)));
y5 = subs(y4,sin(A),(1-cosh(p)^2-cosh(q)^2-cosh(t)^2+cosh(p)*cosh(q)&cosh(t)) / (sinh(p)*sinh(q)));
y6 = subs(y5,sin(B),(1-cosh(q)^2-cosh(r)^2-cosh(u)^2+cosh(q)*cosh(r)&cosh(u)) / (sinh(q)*sinh(r)));
y7 = subs(y6,sin(C),(1-cosh(r)^2-cosh(s)^2-cosh(t)^2+cosh(r)*cosh(s)&cosh(t)) / (s inh(r)*sinh(s)));
y8 = subs(y7,sin(D),(1-cosh(s)^2-cosh(p)^2-cosh(u)^2+cosh(s)*cosh(p)&cosh(u)) / (sinh(s)*sinh(p)));
y8
the answer that I keep getting is:
y8 =
(((cosh(u) and cosh(q)*cosh(r) - cosh(q)^2 - cosh(r)^2 - cosh(u)^2 + 1)*(cosh(t) and cosh(p)*cosh(q) - cosh(p)^2 - cosh(q)^2 - cosh(t)^2 + 1))*(cosh(u) and cosh(p)*cosh(s) - cosh(p)^2 - cosh(s)^2 - cosh(u)^2 + 1)*(cosh(t) and cosh(r)*cosh(s) - cosh(r)^2 - cosh(s)^2 - cosh(t)^2 + 1))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) - (((cosh(t) and cosh(p)*cosh(q) - cosh(p)^2 - cosh(q)^2 - cosh(t)^2 + 1)*(cosh(u) and cosh(p)*cosh(s) - cosh(p)^2 - cosh(s)^2 - cosh(u)^2 + 1))*(cosh(u) - cosh(q)*cosh(r))*(cosh(t) - cosh(r)*cosh(s)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) - (((cosh(t) and cosh(p)*cosh(q) - cosh(p)^2 - cosh(q)^2 - cosh(t)^2 + 1)*(cosh(u) and cosh(q)*cosh(r) - cosh(q)^2 - cosh(r)^2 - cosh(u)^2 + 1))*(cosh(u) - cosh(p)*cosh(s))*(cosh(t) - cosh(r)*cosh(s)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) - (((cosh(t) and cosh(p)*cosh(q) - cosh(p)^2 - cosh(q)^2 - cosh(t)^2 + 1)*(cosh(t) and cosh(r)*cosh(s) - cosh(r)^2 - cosh(s)^2 - cosh(t)^2 + 1))*(cosh(u) - cosh(p)*cosh(s))*(cosh(u) - cosh(q)*cosh(r)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) - (((cosh(u) and cosh(q)*cosh(r) - cosh(q)^2 - cosh(r)^2 - cosh(u)^2 + 1)*(cosh(u) and cosh(p)*cosh(s) - cosh(p)^2 - cosh(s)^2 - cosh(u)^2 + 1))*(cosh(t) - cosh(p)*cosh(q))*(cosh(t) - cosh(r)*cosh(s)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) - (((cosh(u) and cosh(q)*cosh(r) - cosh(q)^2 - cosh(r)^2 - cosh(u)^2 + 1)*(cosh(t) and cosh(r)*cosh(s) - cosh(r)^2 - cosh(s)^2 - cosh(t)^2 + 1))*(cosh(t) - cosh(p)*cosh(q))*(cosh(u) - cosh(p)*cosh(s)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) - (((cosh(t) and cosh(r)*cosh(s) - cosh(r)^2 - cosh(s)^2 - cosh(t)^2 + 1)*(cosh(u) and cosh(p)*cosh(s) - cosh(p)^2 - cosh(s)^2 - cosh(u)^2 + 1))*(cosh(t) - cosh(p)*cosh(q))*(cosh(u) - cosh(q)*cosh(r)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2) + ((cosh(t) - cosh(p)*cosh(q))*(cosh(u) - cosh(p)*cosh(s))*(cosh(u) - cosh(q)*cosh(r))*(cosh(t) - cosh(r)*cosh(s)))/(sinh(p)^2*sinh(q)^2*sinh(r)^2*sinh(s)^2)
when I try to do
factor(y8)
I get "unexpected matlab expression," pointing to the "and." Could anyone help me with this? Thanks
0 Commenti
Risposta accettata
Mischa Kim
il 10 Mag 2014
Modificato: Mischa Kim
il 10 Mag 2014
Lucy, for example, in the expression for y5 there is a term
cosh(p)*cosh(q)&cosh(t)
(typo?) which results in an and. The same (copy-paste?) happens in the other expressions, y6 thru y8.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!