How to solve a complex-valued equation
9 views (last 30 days)
Show older comments
I'm trying to use fzero, but it seems that it can't handle solving for a variable that's complex. Here's my code:
E = 169e9; % Young's Modulus of Silicon [N/m^2] (Assuming one that's isotropic)
W = 2e-6; % Width of Cantilever Beam [m]
H = 2e-6; % Height of Cantilever Beam [m]
L = 5e-6; % Length of Cantilever Beam [m]
V_dc = 5; % DC Voltage [V]
V_ac = 2; % AC Voltage Magnitude [V]
omega = [80e6, .01e6, 110e6]; % Angular Frequency of AC Voltage [rad/s]
g = 5e-6; % Initial Gap between Cantilever Beam and Substrate/Switch Terminal [m]
A = W * H; % Overlap Area between Cantilever Beam and Electrodes [m^2]
e_0 = 8.854e-12; % Permittivity of Free Space [F/m]
k = (E * W * H ^ 3) / (4 * L ^ 3); % Spring Constant of Cantilever Beam [N/m]
% Setting dU/dx equal to kx, and solving for x
for k1 = 1:length(omega)
omega_val = omega(k1);
f = @(x) (1 / 2) * 1i * omega_val * ((e_0 * A) / (g - x) ^ 2) * (V_dc + V_ac) ^ 2 - k * x; % Setting up equation to solve
x(k1) = fzero(f, 0);
end
Basically, omega is a vector of some length with real values, and all the other variables are real as well. But since the imaginary number is present in the equation, the value for x that I'm looking for should be imaginary as well. How would I go about doing this? Thanks in advance.
4 Comments
Bruno Luong
on 2 Dec 2018
"But since the imaginary number is present in the equation, the value for x that I'm looking for should be imaginary as well. "
Not really, you barely multiply your entire relevant expression by 1/2*1i.
If you solve f(x) = 0, it does not change anything fundamental after multiplying the equation by constant that is not equal to 0, where as it's complex, imaginary or real.
Secondly
((e_0 * A) / (g - x) ^ 2)
never vanishes unless |x| = infinity
Accepted Answer
Bruno Luong
on 2 Dec 2018
Edited: Bruno Luong
on 2 Dec 2018
So your equation is of the form
a / (g - x)^2 = k* x
Just multiply by (g - x)^2 in both sides, you'll get
a = (g - x)^2 * k* x
k*x^3 - 2*k*g*x^2 + k*g^2*x - a = 0
The 3 solutions (for each omega) can be obtained by
for k1 = 1:length(omega)
omega_val = omega(k1);
a = (1 / 2) * 1i * omega_val * (e_0 * A) * (V_dc + V_ac)^2;
x = roots([k,-2*g*k,k*g^2,-a])
end
This gives you 3 solutions, I don't know which one you want to pick or not.
More Answers (1)
See Also
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!