how to find roots of equations

4 ビュー (過去 30 日間)
saman ahmadi
saman ahmadi 2020 年 9 月 18 日
コメント済み: saman ahmadi 2020 年 9 月 18 日
Hi. I want to extract roots(w) of below two equation(equations are detA and detB). The roots of equation are with respect to N(w(N)), i want to plot(N,w), how can i do this? thank you
syms w N
k1=70;
k2=200;
m1=0.1;
m2=0.064;
m3=0.04;
r=0.25
M1=(m2+m3)/m1;
M2=m2/m1;
K=k2/k1;
wn1=(sqrt(k1/m1))/(2*pi);
wn2=(sqrt(2*k2/m3))/(2*pi);
A=[-(1+M1)*(w/wn1)^2+2-2*cos(pi) -M2*(w/wn1)^2 -(M1-M2)*(w/wn1)^2;-(w/wn1)^2 -N*(w/wn1)^2+(2*K)/M2 -K/M2;-(w/wn2)^2 -0.5 1-(w/wn2)^2];
detA=det(A)
B=[-(1+M1)*(w/wn1)^2+2-2*cos(0) -M2*(w/wn1)^2 -(M1-M2)*(w/wn1)^2;-(w/wn1)^2 -N*(w/wn1)^2+(2*K)/M2 -K/M2;-(w/wn2)^2 -0.5 1-(w/wn2)^2];
detB=det(B)
  2 件のコメント
BOB MATHEW SYJI
BOB MATHEW SYJI 2020 年 9 月 18 日
How can detA and detB be two equations if they are not equated to anything. Like, is it detA=0 and detB=0.
saman ahmadi
saman ahmadi 2020 年 9 月 18 日
phrases in front of detA and detB are equal to zero

サインインしてコメントする。

回答 (1 件)

Jeremy Perez
Jeremy Perez 2020 年 9 月 18 日
Hi,
Adapt the lines as you want:
1- Get the roots
C = coeffs(detA,w) % w polynom coeffs
r = eval(roots(C)) % roots
2- Replace the symbolic variable in the symbolic function to make the plot function
nRoot = 1; %first root
f = @(x) real(eval(subs(r(nRoot),N,x))) %replace sym N by a num value x
g = @(x) imag(eval(subs(r(nRoot),N,x)))
3-Plot:
x = -1:0.1:1 %begin:step:end
y = arrayfun(f,x)
figure()
plot(x, y)
Hope it helps,
  1 件のコメント
saman ahmadi
saman ahmadi 2020 年 9 月 18 日
thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by