how to find roots of equations

4 visualizaciones (últimos 30 días)
saman ahmadi
saman ahmadi el 18 de Sept. de 2020
Comentada: saman ahmadi el 18 de Sept. de 2020
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 comentarios
BOB MATHEW SYJI
BOB MATHEW SYJI el 18 de Sept. de 2020
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 el 18 de Sept. de 2020
phrases in front of detA and detB are equal to zero

Iniciar sesión para comentar.

Respuestas (1)

Jeremy Perez
Jeremy Perez el 18 de Sept. de 2020
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,

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by