Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Tarsem Singh Khalsa
Tarsem Singh Khalsa 2018 年 4 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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.
Tarsem Singh Khalsa
Tarsem Singh Khalsa 2018 年 4 月 15 日
Thanx that worked perfectly.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by