Clear Filters
Clear Filters

How to solve this equation?

2 views (last 30 days)
Ali Almakhmari
Ali Almakhmari on 24 Sep 2023
Edited: John D'Errico on 25 Sep 2023
I have this equation:
s is a complex number. I want to use MATLAB to figure out what critical value of τ that causes this equation to have the solution, in other words, s, to have a positive number for the real part of s.
  1 Comment
Torsten
Torsten on 24 Sep 2023
Edited: Torsten on 24 Sep 2023
Which equation ? What you write is a mathematical expression, not an equation.
I'm surprised "fmincon" cannot do better:
format long
s0 = [1 1 1];
sol = fmincon(@f,s0,[],[],[],[],[0 -Inf -Inf],[Inf Inf Inf],[],optimset('MaxFunEvals',10000,'MaxIter',10000));
Local minimum possible. Constraints satisfied. fmincon stopped because the size of the current step is less than the value of the step size tolerance and constraints are satisfied to within the value of the constraint tolerance.
sol
sol = 1×3
1.0e+03 * 0.000000000000109 -0.000000731599559 4.292766616773154
f(sol)
ans =
1.000003668571633
function obj = f(s)
sr = s(1);
si = s(2);
tau = s(3);
obj = norm((sr+1i*si)^2+4*(sr+1i*si)+3+2*exp(-tau*(sr+1i*si)))^2;
end

Sign in to comment.

Accepted Answer

Sam Chak
Sam Chak on 24 Sep 2023
It seems that there are no real solutions for τ. From the graph, we can see that we need to lower the quadratic by more than 3 units in order to obtain one positive real root for s. In other words, there are no real solutions for because . You can check when τ is an infinitely large value.
s = linspace(-4, 3, 7001);
y1 = s.^2 + 4*s + 3; % 2nd-degree polynomial (poly2)
y2 = 2*exp(-(+1)*s);
y3 = 2*exp(-(-1)*s);
plot(s, [y1; y2; y3]), ylim([-5 20]), grid on
xline(0, '--')
yline(3, '--', 'y = 3')
xlabel('s')
legend('poly2', '\tau = 1', '\tau = -1', '', '', 'fontsize', 12, 'location', 'best')

More Answers (1)

John D'Errico
John D'Errico on 24 Sep 2023
Edited: John D'Errico on 25 Sep 2023
As I see it, from your question, I think people have been missing the point. As has been said, there are no real solutions for s, for any (real) value of tau. But since you are willing to accept complex solutions, as long as the real part of s is positive, then what can you do? You asked for the critical value of tau, that yields a solution with positive real part. That is different from a real solution for s.
And of course, solve cannot handle this probem. I'll arbitrarily choose tau = 1 first, just to get a feeling for what is happening. A plot will always make things easy to understand.
tau = 1;
Rs = @(sr,sc) real((sr+i*sc).^2 + 4*(sr+i*sc) + 3 + 2*exp(-tau*(sr+i*sc)));
Is = @(sr,sc) imag((sr+i*sc).^2 + 4*(sr+i*sc) + 3 + 2*exp(-tau*(sr+i*sc)));
Since I care about solutions with a positive real part, look at the right half plane, even though I also plotted the left half plane too.
fimplicit(Rs,'r',[-10,10,-10,10])
hold on
fimplicit(Is,'b',[-10,10,-10,10])
hold off
grid on
xlabel 'Real part of s'
ylabel 'Imaginary part of s'
Remember, we need to look for where the red and blue lines cross. And they do not cross in the right half plane. Different values of tau, as long as tau is a positive number, never seem to show a crossing in the RIGHT half plane. If tau is negative, then solutions do exist.
tau = -1;
Rs = @(sr,sc) real((sr+i*sc).^2 + 4*(sr+i*sc) + 3 + 2*exp(-tau*(sr+i*sc)));
Is = @(sr,sc) imag((sr+i*sc).^2 + 4*(sr+i*sc) + 3 + 2*exp(-tau*(sr+i*sc)));
Again, since I care about solutions with a positive real part, look at the right half plane.
fimplicit(Rs,'r',[-10,10,-10,10])
hold on
fimplicit(Is,'b',[-10,10,-10,10])
hold off
grid on
xlabel 'Real part of s'
ylabel 'Imaginary part of s'
And there we see multiple solutions in the right half plane. Given the figure, I'd expect to see a solution at roughly s=3+4.5i, when tau=-1.
syms S
vpasolve(S.^2 + 4*S + 3 + 2*exp(-tau*S),S,3+4.5i)
ans = 
I might hazard a guess that for any negative value for tau, a solution does exist with positive real part. In fact, for negative values of tau, I might conjecture there will be infinitely many solutions with positive real part. Conversely, for positive values of tau, we might be able to prove there exists no solution with positive real part. That would take some thought of course. Anyway, What happens at tau==0?
solve(S.^2 + 4*S + 3 + 2*exp(-0*S))
ans = 
Ah. When tau is zero, then there is no positive real part solution, yet we found a solution for at least one negative value of tau. And that suggests there could possibly be a "critical" negative value of tau where the solutions begin to arise. Or it might suggest that a solution exists for only negative tau, and that as tau approoaches zero from belo, the solutions go to infinity.
tau = -0.25
tau = -0.2500
Rs = @(sr,sc) real((sr+i*sc).^2 + 4*(sr+i*sc) + 3 + 2*exp(-tau*(sr+i*sc)));
Is = @(sr,sc) imag((sr+i*sc).^2 + 4*(sr+i*sc) + 3 + 2*exp(-tau*(sr+i*sc)));
fimplicit(Rs,'r',[0,50,-50,50])
hold on
fimplicit(Is,'b',[0,50,-50,50])
hold off
grid on
xlabel 'Real part of s'
ylabel 'Imaginary part of s'
And there we do find solutions.
So, are negative values of tau acceptable? Is there a valid reason to chase down this rabbit hole to actually identify IF some critical value does exist, and what it is for negative tau?

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!