Info

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

Can anybody help me in simplifying the final solution of 'y' in terms of variable? It can be easily solve by hand and we can get values as a factor of '(1/l)*sqrt(T/rho)'.

1 回表示 (過去 30 日間)
Prateek jain
Prateek jain 2018 年 4 月 25 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
clc;
clear all;
close all;
syms T h l rho F1 F2 omega
mem=4 %number of elements
h=l/mem
%element k matrix
k=h\T*[1 -1;-1 1];
m=(rho*h/6)*[2 1;1 2]
% assembling global matrix
tightwire=importdata('TightWire.xlsx');
S=zeros(mem+1,'sym');
M=zeros(mem+1,'sym');
U=sym('U%d',[mem+1 1])
F=sym('F%d',[mem+1 1])
for t=2:mem
F(t)=tightwire(mem,t);
end
%elementnumbering
nod=[1:1:mem+1];
c=cell(mem,1);
for t=1:mem
c{t,1}=[nod(t) nod(t)+1];
end
for r=1:mem
l=c{r};
for i=1:mem+1
for j=1:mem+1
for o=1:2
for p=1:2
if i==l(o)
if j==l(p)
S(i,j)=S(i,j)+k(o,p);
M(i,j)=M(i,j)+m(o,p);
end
end
end
end
end
end
end
determinant=S(2:mem,2:mem)-omega^2*M(2:mem,2:mem)
y=solve(det(determinant),omega)

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 4 月 25 日
Change
syms T h l rho F1 F2 omega
to
syms T h l rho F1 F2 omega real
Change
y=solve(det(determinant),omega)
to
y = simplify(solve(det(determinant),omega))
  6 件のコメント
Prateek jain
Prateek jain 2018 年 4 月 26 日
now code is working great but still it is showing error in last line.'undefined function 'gt' for input argument of type 'cell'.
ch = children(ysim);
constant_is_in_column = 4;
constants = cellfun(@(C) C(constant_is_in_column), ch,'uniformoutput',false);
sorted_constants = sort(constants(constants>0));
Walter Roberson
Walter Roberson 2018 年 4 月 26 日
You should not use uniform 0 there unless you are using older MATLAB versions that do not permit you to create symbolic output from a cellfun. But if you are then
constants = [constants{:}]

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by