Strange behavior with symbolic and atan
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am solving a time derivative equation in Matlab. atan is part of the solution. It seems to behave strangely when atan(tan) is around. Although, I am not sure. I have attached the script with my problem. This represents a simple circuit in real life.
In the first part of the script, I represented 10e-9 as rational representation, sym(10e-9, 'r'). This seems to give me discontinuity when tan -> inf, at t=0.5 in this case. To my surprise, representing 10e-9 as a floating point in the second part, solves this problem and give me very close results compared to the real world data! Moreover (maybe unrelated), analysing vSol in the second part show parts that go to 0 but isn't simplified!
I would like to get more idea of what is going on before solving a more complicated problem.
Thanks.
0 comentarios
Respuestas (1)
Walter Roberson
el 29 de Mayo de 2018
The oddity you see in the plot is the correct theoretical form.
After substitution of f = 1, there is a subexpression which is arctan(tan(pi*t)/sqrt(3)) . The tan goes to infinity as t = 1/2 from the left, and since tan is discontinuous, the tan goes to -infinity as t = 1/2 from the right. arctan() therefore goes to pi/2 from the left but -pi/2 from the right. Taking into account the other parts of the expression, the limit from the left is 3000*exp(-(1/30)*sqrt(3)) and the limit from the right is 3000*exp((1/30)*sqrt(3))
2 comentarios
Walter Roberson
el 29 de Mayo de 2018
It appears that with the round-off error of converting the floating point version, that the expression ends up with subtracting off an arctan(tan(2*pi*f*t)) term; I guess that ends up canceling out the problem somehow because both arctan() would be on the same side of zero ?
Ver también
Categorías
Más información sobre Special Values en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!