Info

此问题已关闭。 请重新打开它进行编辑或回答。

How can I avoid 'and' in result? or any other way to solve

1 次查看(过去 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
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!

Translated by