How to solve a complex-valued equation

9 Ansichten (letzte 30 Tage)
Ajay Gupta
Ajay Gupta am 2 Dez. 2018
Bearbeitet: Bruno Luong am 2 Dez. 2018
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 Kommentare
Bruno Luong
Bruno Luong am 2 Dez. 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
Ajay Gupta
Ajay Gupta am 2 Dez. 2018
I'm subtracting by k*x at the end, so I think x should almost always be some complex number. I also realized that I forgot to include the initialization for k in my code, so I've corrected it. I removed it before from my original code because I thought it wasn't necessary for the question being asked.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 2 Dez. 2018
Bearbeitet: Bruno Luong am 2 Dez. 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.

Weitere Antworten (1)

Stephan
Stephan am 2 Dez. 2018
Hi,
use fsolve to handle complex valued problems. Fzero only can handle real valued problems.
Best regards
Stephan

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by