Any MATLAB Filter that changes cosine to sine?

Status
Not open for further replies.

testing test

Member level 3
Joined
Mar 3, 2010
Messages
65
Helped
5
Reputation
10
Reaction score
3
Trophy points
1,288
Activity points
1,656
Hi,

I have a cosine input and I want it to multiply with a filter which changes the cosine to sine. The following code just plots a cosine signal. I want to multiple x with impulse response of a filter such that the output is a sine signal. Please help me design any such filter via coding.

Code:
N=100;
t=0:N;
f1=20;
fs=300;
x=cos(2*pi*f1/fs*t);
plot(t,x);

Thank you!
 

I would take advantage of the fact that
sin(x) = -dcos(x)/dt
The filter is then a simple differentiator...
y[n] = x[n] - x[n-1];
 
Can you please give me a few lines of MATLAB code for implementation of this filter?
 

y = filter([1, -1], 1, x);
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…