How to solve a complex-valued equation

9 ビュー (過去 30 日間)
Ajay Gupta
Ajay Gupta 2018 年 12 月 2 日
編集済み: Bruno Luong 2018 年 12 月 2 日
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 件のコメント
Bruno Luong
Bruno Luong 2018 年 12 月 2 日
"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 2018 年 12 月 2 日
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.

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2018 年 12 月 2 日
編集済み: Bruno Luong 2018 年 12 月 2 日
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.
  1 件のコメント
Ajay Gupta
Ajay Gupta 2018 年 12 月 2 日
Thanks for the help!

サインインしてコメントする。

その他の回答 (1 件)

Stephan
Stephan 2018 年 12 月 2 日
Hi,
use fsolve to handle complex valued problems. Fzero only can handle real valued problems.
Best regards
Stephan

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by