how to find roots of equations
조회 수: 3 (최근 30일)
이전 댓글 표시
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
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.
답변 (1개)
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 Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!