MATLAB Answers


stable approximation of (1/cosx)

Asked by surya
on 30 Sep 2013
Latest activity Answered by Jan Simon
on 30 Sep 2013

I'm trying to simulate a function that has a 1/cos(x) term. The value of 1/cos(x) tends to infinity as cos(x) approaches zero. Is there any way to smoothly approximate this function in order to avoid the jumps around pi/2 neighborhood? I'm looking for some sort of smoothing, but in real-time. Please help.



Log in to comment.



1 Answer

Answer by Jan Simon
on 30 Sep 2013

The function 1/cos(x) goes to infinity for |cos(x) -> 0|. There is absolutely no way to "smooth" this away. The results would be wrong from the view point of mathematical correctness. Even "real-time" is not the problem here.

If you have any good reason why the pole does not appear in the physical system (or what ever this formula describes), please mention it here.


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!