MATLAB Answers

Matlab solver results in empty sym: 0-by-1

1 view (last 30 days)
Hello,
I thought that the equation I was solving was fairly simple. I am trying to solve for theta from the equation.
The solver results in empty sym: 0-by-1.
What am I missing here? There is 1 unknown and one equation. I thought the abs() command would take care of the complex numbers on its own?
theta_value should be close to 0.244.
syms s theta Y Z omega
%Hertz
f =186;
%Input Amplitude (m/s^2)
A_o = 3;
%Damping coefficient (N*s/m)
C_d = 0.07;
%Resistance R_c (Ohms)
R_c = 40;
%Resistance R_l (Ohms)
R_l = 5000;
%Inductance L_c (Henrys)
L_c = 0.051;
%Mass (kg)
M=0.01;
%Spring coefficient (N/m)
k = 13660;
%Frequency (rad/s)
omega_in = 2*pi*f;
Z1 = R_c+R_l+L_c*s;
Z2 = C_d+k/s+M*s;
V_l = (theta*(Y*s)*R_l)/Z1;
Z_in=(Y*s*Z2+theta*V_l/R_l)/(s^2*M);
Transfer_func = simplify(V_l/Z_in);
Transfer_func(s) = vpa(simplify(V_l/Z_in),5);
Transfer_func(omega) = subs(Transfer_func, {s},{1j*omega});
%Solving system of matrices for magnitude of V_l(omega*j)/Z_in(omega*j)
A = [ 3 ];
B = [0.1037];
X1 = linsolve(A,B);
%Solving equation for value of theta
mag_VZ = abs(Transfer_func(omega_in))
X2 = mag_VZ == X1;
theta_value = solve(X2,theta)

  0 Comments

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 5 Jun 2020
Edited: Ameer Hamza on 5 Jun 2020
solve() is used to find an analytical solution. The result shows that an analytical solution might not exist for your equation.
Also, the solution to the equation is not around 0.224. If you make draw a graph of mag_VZ, you will see at theta=0.224 the value is in the order .
fplot(mag_VZ, [0 0.3])
xline(0.244)
You can find a solution using fsolve(). Use the following line instead of solve() to find a numerical solution
fun = matlabFunction(mag_VZ);
sol = fsolve(@(x) fun(x)-X1, 0)
Result
sol =
1.7865e-07
This solution satisfies the equation.

  1 Comment

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!