Reputation: 3409
I'm trying to convert a signal back and forth using trigonometric functions. In the example below:
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) 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')
Upvotes: 1
Views: 260
Reputation: 13886
Your y3
calculation is incorrect:
sec(y2) = 1/cos(y2) = 1/cos(1/cos(x))
y3 = sec(y2) * sec(y2) = 1 / cos(1/cos(x))^2
.
This is not equal to cos(x)
, so there's no reason for y3
to look like y
in any way.
Upvotes: 0