How can I generate cos wave?

Forum for discussing PicoScope version 6 (non-automotive version)
Post Reply
iscool2@gmail.com
Newbie
Posts: 0
Joined: Mon Mar 21, 2016 11:48 am

How can I generate cos wave?

Post by iscool2@gmail.com »

Hello,
I can generate sin wave with 5244B Signal Generator. It works fine.
I connected CH-A to Gen connector and it shows the sine wave to the Channel-A.
I needed to show cosine wave to the same view, so I added new Math Channel like this, but it's not expected wave.
cos(sinh(A)*0.0174533)
here, 0.0174533 is the value to change degee to radian.
0.0174533 = pi/180

Actually, at first I entered like this:
cos(sinh(A)*pi/180.0)
but Picoscope notified me "Invalid formula".

I attached a picture for the expected wave.
How can solve it?
I would like to here from you the correct way to clear my problem.

Thanks,
YoungTaek
Attachments
Cos(x)sin(x).png

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: How can I generate cos wave?

Post by hexamer »

The main issue with the formula you're trying is that sinh is hyperbolic sine, not inverse sine. The easiest way I can think to get what you want is to take the first derivative: d/dx(sin(x)) = cos(x).

With derivative, you'll have to apply a filter as well because of the noise on the channel.

E.g. for a 1 kHz sine:

derivative(LowPass(A,5000))

The other thing I had to do to is override the range (last step in the Math Channel Wizard). Apparently the scale is ADC counts. So set the scale to -32767, 32767.

iscool2@gmail.com
Newbie
Posts: 0
Joined: Mon Mar 21, 2016 11:48 am

Re: How can I generate cos wave?

Post by iscool2@gmail.com »

I understand that "derivative(LowPass(A,5000))" is the cosine wave, thanks.
By the way, I tried to make cos wave like this, but it's not the expected wave.
Integral(A)

What am I wrong?

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: How can I generate cos wave?

Post by hexamer »

iscool2@gmail.com wrote:I understand that "derivative(LowPass(A,5000))" is the cosine wave, thanks.
By the way, I tried to make cos wave like this, but it's not the expected wave.
Integral(A)

What am I wrong?
When I was investigating this, I had also tried Integral(A). To get this to even look reasonable I had to play with the scaling - initially I was just getting a flat line. It didnt really make sense to me why I had to adjust it the way I did: IIRC it was +/- 0.001.

In any case, remember that the integral of sin is -cos + D. If there is any offset in the signal it will show up in the integral. In my experiments I did have an offset, but it did not seem to continue to grow, so the integral may be getting reset on every block/window of data.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: How can I generate cos wave?

Post by Martyn »

The integral is calculated per screen of data, and as Hexamer said there will be an offset. The offset is related to the starting point of the trace on the screen, if it starts in the negative cycle , the offset will be negative, positive and the offset will be positive. The required scaling will be related to the timebase, and time on screen.
Martyn
Technical Support Manager

hexamer
Advanced User
Advanced User
Posts: 5
Joined: Tue Aug 12, 2014 10:09 pm

Re: How can I generate cos wave?

Post by hexamer »

Martyn wrote:The required scaling will be related to the timebase, and time on screen.
Thanks for the explanation, Martyn. That makes sense.

Post Reply