How to solve this complicated expression to get real roots?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kalasagarreddi Kottakota
el 30 de Mzo. de 2022
Editada: David Goodmanson
el 31 de Mzo. de 2022
The following is a complicated expression for which I need to find a real value for
such that the expression equals to zero:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/945914/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/945919/image.png)
clear all; clc;
c0 =340;
M=41;
dm = [0.721 0.680 0.640 0.602 0.565 0.531 0.5000 0.471 0.447 0.427 0.412...
0.403 0.400 0.403 0.412 0.427 0.447 0.471 0.500 0.531 0.565 0.602...
0.640 0.680 0.721 0.763 0.806 0.850 0.894 0.939 0.984 1.030 1.077...
1.123 1.170 1.217 1.265 1.312 1.360 1.408 1.456]';
tm = dm/c0;
Hm = 1./dm;
% A
A1 = sum( abs(Hm(:)).^2 .* [-ones(M,1) +3*tm(:) -3*tm(:).^2 tm(:).^3]);
A =0.25* sum( abs(Hm(:)).^2)*conv(A1,A1);
% B
B1 = sum( abs(Hm(:)).^2 .* [ones(M,1) -4*tm(:) +6*tm(:).^2 -4*tm(:).^3 tm(:).^4]);
B2 = sum( abs(Hm(:)).^2 .* [-ones(M,1) tm(:)]);
B = 0.25*conv(conv(B2,B2),B1);
P = A+B;
t0_roots = roots(P); % roots
When I compute for
by above code resulted in complex roots:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/945924/image.png)
t0_roots =
0.0013 + 0.0015i
0.0013 - 0.0015i
0.0020 + 0.0002i
0.0020 - 0.0002i
0.0017 + 0.0006i
0.0017 - 0.0006i
Now I have taken one of the roots,
t0 = t0_roots(1);
E = .25*(sum(abs(Hm.').^2)*sum(abs(Hm.').^2 .* (tm(:).' - t0).^3, 2).^2 ...
+ sum(abs(Hm.').^2 .* (tm(:).' - t0).^4, 2) .* sum(abs(Hm.').^2 .* (tm(:).' - t0), 2).^2); % expression value
The resulted E
E = 1.2177e-25 + 2.5445e-26i
Lets assume the root as a real number
and calculate E,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/945929/image.png)
E = 2.7709e-13
In this regard, could someone help to find real value for t0 for the expression to be zero.
4 comentarios
Matt J
el 30 de Mzo. de 2022
The two terms are added together so it appears thatfor real t this result cannot possibly be zero unless [1] some of the tm are complex, or [2] the trivial case where all the Hm are zero.
No, you could have, for example,
Hm=[1,1];
tm=[1,-1];
t0=0;
David Goodmanson
el 30 de Mzo. de 2022
Editada: David Goodmanson
el 31 de Mzo. de 2022
Certainly in this particular case Hm has many nonzero values, there are many different values of tm with corresponding nonzero values of Hm. So both the first sum and B1 are positive. Both A1^2 and B2^2 are positive or zero, so for the whole works to be zero, both A1 and B2 must be zero. For B2, the solution is
t0 = Sum(tm.*Hm.^2) / Sum(Hm.^2)
t0 = 0.001642868116609
and when plugged into A1, the result has to be zero. The result, A1 = 5.7296e-08 is surprisingly small but I beleive it is not consistent with zero. Evidently there is not a solution for real t0.
Respuesta aceptada
Matt J
el 30 de Mzo. de 2022
Editada: Matt J
el 30 de Mzo. de 2022
Based on the plot, the minimum value of the expression would lie somewhere between -0.005 and 0.008, so using fminbnd(),
[x,fval]=fminbnd(@expression,-0.002,0.006)
warning off;
fplot(@expression,[-0.005,0.008]);
function E = expression(t0)
c0 =340;
M=41;
dm = [0.721 0.680 0.640 0.602 0.565 0.531 0.5000 0.471 0.447 0.427 0.412...
0.403 0.400 0.403 0.412 0.427 0.447 0.471 0.500 0.531 0.565 0.602...
0.640 0.680 0.721 0.763 0.806 0.850 0.894 0.939 0.984 1.030 1.077...
1.123 1.170 1.217 1.265 1.312 1.360 1.408 1.456]';
tm = dm/c0;
Hm = 1./dm;
E = .25*(sum(abs(Hm.').^2)*sum(abs(Hm.').^2 .* (tm(:).' - t0).^3, 2).^2 ...
+ sum(abs(Hm.').^2 .* (tm(:).' - t0).^4, 2) .* sum(abs(Hm.').^2 .* (tm(:).' - t0), 2).^2); % expression value
end
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!