Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How can I avoid 'and' in result? or any other way to solve
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm writing a code for vibration of beam, the problem is that after derivation and substituting boundary values the result contains 'and' relation between two equation. It maybe due to the assumption, but it is necessary. Is there a way to avoid 'and' in this result?
BC: (for cantilever beam, beam length = 4m)
Y(x=0)=0
Y'(x=0)=0
Y''(x=4)=0
Y'''(x=4)=0
code:
Y=A*sin(b*x)+B*cos(b*x)+C*sinh(b*x)+D*cosh(b*x);
Yx=[1 0;1 0;0 1;0 1];
% Yx(i,j)=> i=n, (n-1)th derivative of Y
% j=1, at x=0; j=2, at x=Length of beam
assume(b>0);
t=0;
for i=1:4
for j=1:2
if Yx(i,j)==0
continue
end
t=t+1;
dY=diff(Y(x,b),x,(i-1));
F=simplify(expand(subs(dY,x,Yx(5,j))==0,'ArithmeticOnly',true));
c=symvar(F);
if or(size(c,2)==1,c(1)~='b')
d=1;
else
d=2;
end
if t==4;
assume(c(d)~=0)
Y=simplify(expand(F,'ArithmeticOnly',true));
else
G=solve(F,c(d));
Y(x,b)=subs(Y,c(d),G);
end
end
end
disp(Y);
The final result is like this:
Y = sin(4*b) + sinh(4*b) ~= 0 and cosh(4*b)^2 + 2*cos(4*b)*cosh(4*b) + 1 == sinh(4*b)^2
I'm using Matlab R2013a
댓글 수: 2
Walter Roberson
2018년 4월 14일
You should be able to add an assume() that asserts the first relationship to be true and then it should simplify() out.
It does appear to be true for all positive b.
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!