Test and Measurement Forum

How can I generate cos wave?

Forum for discussing PicoScope version 6 (non-automotive version)

How can I generate cos wave?

Postby iscool2@gmail.com » Thu Apr 07, 2016 8:33 am

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
iscool2@gmail.com
Newbie
 
Posts: 0
Joined: Mon Mar 21, 2016 11:48 am

Re: How can I generate cos wave?

Postby hexamer » Sat Apr 09, 2016 3:14 pm

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.
hexamer
Advanced User
Advanced User
 
Posts: 62
Joined: Tue Aug 12, 2014 10:09 pm

Re: How can I generate cos wave?

Postby iscool2@gmail.com » Mon Apr 11, 2016 2:31 am

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?
iscool2@gmail.com
Newbie
 
Posts: 0
Joined: Mon Mar 21, 2016 11:48 am

Re: How can I generate cos wave?

Postby hexamer » Mon Apr 11, 2016 7:47 pm

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.
hexamer
Advanced User
Advanced User
 
Posts: 62
Joined: Tue Aug 12, 2014 10:09 pm

Re: How can I generate cos wave?

Postby Martyn » Tue Apr 12, 2016 6:16 am

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 Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2339
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: How can I generate cos wave?

Postby hexamer » Tue Apr 12, 2016 10:29 pm

Martyn wrote:The required scaling will be related to the timebase, and time on screen.
Thanks for the explanation, Martyn. That makes sense.
hexamer
Advanced User
Advanced User
 
Posts: 62
Joined: Tue Aug 12, 2014 10:09 pm


Return to PicoScope 6 for Windows

Who is online

Users browsing this forum: No registered users and 0 guests