trigonometric equation solution help

1 vue (au cours des 30 derniers jours)
Giuseppe Avallone
Giuseppe Avallone le 23 Mar 2022
Hi everyone,
I need to solve the following equation:
with k as unknown, in the range ]0.5 , 1]
I try with this,
syms err space k
vq_equation = err^2 == (space^2 * (2 - 2*cos(4*pi*k))/(8*pi^2*k^2*(4*k^2+1)).^2);
assume(k>0.5 & k<=1)
a = solve(vq_equation,k);
but the result is
Warning: Unable to find explicit solution. For options, see help.
> In sym/solve (line 317)
Have you got any idea?

Réponse acceptée

Torsten
Torsten le 23 Mar 2022
When I plot the function for several values of err and space, I only see a zero at k=0 and k=0.5.
Can you give values for err and space such there are more zeros in (0.5,1) ?
  2 commentaires
Giuseppe Avallone
Giuseppe Avallone le 23 Mar 2022
Hi,
by plotting err as a function of k for several space i found different values in the range ]0.5 , 1].
So, to answer your question, you can run this (i plot the two sides of the equation and the intersection is in that range).
err = 0.00614737147202947;
space = deg2rad(5);
k = linspace(0.3,1.0,1000);
memb1 = err^2*(8*pi^2*k.^2.*(4*k.^2-1)).^2;
memb2 = space^2 * (2 - 2*cos(4*pi*k));
figure
hold on
grid on
plot(k',[memb1', memb2']);
legend('memb1','memb2')
Torsten
Torsten le 23 Mar 2022
Modifié(e) : Torsten le 23 Mar 2022
An analytical solution for k using MATLAB's "solve" is not probable.
I rewrote the equation as
a^2*(8*pi^2*k^2*(4*k^2-1))^2 - 2*(1-cos(4*pi*k) = 0
with the dimensionless number a = err/space and solved for k in the interval [0.5:1] for a given value of a.
The result is plotted.
A = 0:0.001:0.2;
nk = 1000;
k_min = 0.50001;
k_max = 1.0;
dk = (k_max-k_min)/nk;
for i = 1:numel(A)
a = A(i);
f = @(k) a^2*(8*pi^2*k.^2.*(4*k.^2-1)).^2 - 2*(1-cos(4*pi*k));
k = k_min;
fl = f(k);
flag = 0;
while k < k_max
k = k + dk;
fr = f(k);
if fl*fr <= 0
sol_k(i) = k-dk/2.0;
flag = 1;
break
end
fl = fr;
end
if flag == 0
sol_k(i) = NaN;
end
i
end
plot(A,sol_k)

Connectez-vous pour commenter.

Plus de réponses (1)

David Goodmanson
David Goodmanson le 24 Mar 2022
Modifié(e) : David Goodmanson le 24 Mar 2022
Hi Giuseppe
Although Matlab can't come up with an analytic solution with symbolics, you can still obtain a numerical solution that does not involve doing a numerical solve for each desired value of err^2. (err^2 is denoted by e2 here). For a vector of values e2_new, the code below works much like an analytic expression would.
At k = 1/2, e2 has the form 0/0. It's obvious from the plot that the value of e2 is s^2/2 there. It's possible to prove it, but I am just as happy not to have to.
In place of spline( ...) you can use interp1(...,'spline') which is more prominently documented than spline is these days.
s = 3
k = linspace(1/2,1,1e5);
e2 = fun(k,s);
plot(k,e2) % the allowed range of e2 is 0 to s^2/2.
% pick a few values of e2 (in the allowed range)
e2_new = [2 2.5 3 3.2 4 4.1];
k_new = spline(e2,k,e2_new); % the solution
% check to see that the function works, difference is small
fun(k_new,s) - e2_new
ans = 1.0e-13 *
-0.0022 0.0266 0 -0.0133 -0.0844 0.4263
function e2 = fun(k,s)
e2 = s^2*(2-2*cos(4*pi*k))./(8*pi^2*k.^2.*(4*k.^2-1).^2);
e2(abs(k-1/2)<1e-10) = s^2/2;
end

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by