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,

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by