I'm trying to convert a signal back and forth using trigonometric functions. In the example below:
- 1) start off with a cos signal
- 2) convert the signal to a secant signal
- 3) would like to convert the secant signal back to the original cosine signal using Trig. (Is this possible?)
I know sec=1/cos I was trying to see if simple algebra would get the original signal back but it looks like my understanding of Trig is lacking, as you can see in the third plot below it doesn't go back to the original cos signal which is what I'm trying to do.
And please don't post just use cos (x) or 1/y2. This is a simple example showing what I'm trying to do, the real code is about 500 lines with multiple functions that it calls. I'm trying to see if there is a way to get back to the original signal using Trig and matlab/octave
Here's the example matlab / octave code below:
clear all, clf
x = linspace(0,2*pi,1000);
y = cos(x); %
subplot(3,1,1);
plot(x,y)
title('original signal')
y2 =1./cos(x); % secant
subplot(3,1,2);
plot(x,y2)
title('converted signal')
y3 =sec(y2).*sec(y2); % this section is incorrect not sure how to fix it
subplot(3,1,3);
plot(x,y3)
title('back to original cos signal from secant')

You should be using
y3=cos(asec(y2))if you wanty3to equaly. You current method is$$ \cos(x) = \sec^2(\sec(x)) = { {1} \over {\cos^2( 1/\cos(x) )} }, $$
which is incorrect. You first need to to get the argument that gives you the value of
y2:$$ x = \sec^{-1}(y_2). $$
This of course then leads to $y_3 = \cos( \sec^{-1} ( \sec(x) ) ) = \cos(x) = y$.