Best fit lines for loops and sine waves

I am trying to find a best fit line that will work for sine waves and loops (hysteresis loops). I can get the sine wave just fine, but when I switch to a hysteresis it just puts a line across the middle (I assume because of the 2 y values for every x). I am doing data acquisition that will take in both forms and graph them. I tried a polynomial fit and it doesn't work at least the way I implemented it and I tried a few others but it looks like they are all function based. Also, my y values are coming out of a Bessel filter. I don't think this would be affecting anything but I thought I would put it in here incase it does.
Did I miss one that I haven't tried that works for my application?
Thanks
Patrick

RiversDaddy wrote:
... currently I am doing it by looping and reducing the error towards zero to fit the amplitude and phase. (I know the frequency).  If this is what you are looking to do then I will help, or should I be doing things differently? All of the functions I have found to filter or extract tones seem to introduce a larger frequency of phase error than i get using this method, but am I missing something?
"looping" is a bit vague. What is the actual algorithm to find better estimates (e.g. levenberg marquardt, etc.)
What problems did you have with extract single tone. Can you show some data where the results from it are not good?
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Log scale of the axis and the best-fit line

    I try to plot a graph and set the scale of the x-axis to log scale and then i try to plot a linear trendline (best fit line). but the linear trendline does now show on the graph. but if i set the axis scale to linear, then the trendline does show.  i will need my graph in the log scale and also a linear best fit line. please help me out

    0
    100
    3.00E-09
    71.52
    1.00E-08
    57.3
    3.00E-08
    39.15
    1.00E-07
    24.13
    3.00E-07
    14.77
    1.00E-06
    7.22
    i meant you these data, and left column is x-axis and gonna use log scale for the axis. the right column is the y axis. and then i need a best fit line for this graph.. hope you can help me

  • How to dynamically adjust Frequency, Phase and Amplitude for a Generated Sine Wave in C/C++?

    Hi,
    I wonder if anybody know how to dynamically adjust Frequency, Phase and Amplitude for a Generated Sine Wave in C/C++? This is a part of my project: I need to dynamically generate a sine wave voltage signal by some calculation using the data from a simultaneous analog input and another signal.
    Your help will be appreciated so much!
    Marlon

    Hello Marlon,
    Here is an example of changing frequency and ampliude for an E-series device in Labwindows/CVI. The programming should be similar in C for your S-Series device. As is says on the linked webpage above, this process is going to be very processor intensive since you will continually be creating a buffer.
    Nicholas C
    National Instruments
    Applications Engineering

  • How do i find where 2 best fit lines cross?

    Hi
    I was wondering if anyone knows a way to find where 2 best fit lines cross, I don't have the equation for the lines and i'm not sure if I can get it.
    I currently have the program tracing the lines and comparing y values however it will only increment in steps of 0.1 on the x-axis and i need an accuraccy of 0.0001

    If you have or can get a series of XY value pairs for both of the lines, getting the equation of the line is as simple as calling Linear Fit.vi.  Once you have the equations of both lines, the intersection is simple algebra, subject to the accuracy of your fit.  If the XY data pairs describe a curve, not a line, and you want more accuracy, you can try a polynomial fit using General Polynomial Fit.vi.  To find the intersection, set one polynomial equation equal to the other, compute the coefficients of the resulting polynomial equation, and find the root using Polynomial Roots.vi.  All this assumes you have a Pro or better version of LabVIEW.  If you don't, you can still do it, but you will need to write some code for the fits and roots.  Check out a copy of Numerical Recipes in C, by Press et. al. from your local library and it will give you the equations for all the above.  With LabVIEW's native matrix handling capabilities, the rest is straighforward.
    Let us know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Is it possible to apply a best fit line to charts?

    The topic pretty much says it all, I have a scatter chart that I need to apply a best fit line to in order to make a general slope assumption. Is it possible to do this, and if so how?
    Also, I can't seem to put a label on my X and Y axis'. I have the number increments that I need, but I need to give them a name. For example, the x-axis needs to be Volume in mL and the y-axis needs to say Mass in grams. Is it possible to do this?
    Thanks very much in advance to anyone who can help.
    Daniel

    The charting function in the iWork suite is fairly rudimentary -- there is no functionality for doing regression or best-fit lines, and the axes labels have to be created by hand.

  • "best fit" lines

    I have a basic line graph that shows the spending $ trend of three business units over time (5 year history at month level). I'd like to add "best fit" lines to make it easier for end users to discern the trend without all the hills and valleys. How do I accomplish that in 11g? I haven't seen any graph that adds this by itself, so I'm assuming I need to calculate a new "best fit" metric or something?
    Thanks,
    Scott

    Here's a visual example. Column C creates a 3-point moving average that is plotted along with the data values. I'll send you the example. You can create any equation that you'd like depending on your use.
    Regards,

  • Is it possible to show a best fit line

    i am plotting percent fructose V.S density and trying to do a best fit line. A connect the dots jagged line would not be appropreate. Is it possibleto do this?

    Short answer: No. Wait to see what the next version brings. The only real work-around is to add a data set using the same x values and new y values, predicted from the linear regression. You would then have to draw a line over the resulting plot points manually. Then, "hide" the extra data set by eliminating the data point fill and outline.
    Only help I can offer is to look in your Utilities folder for an app named "Grapher." It can do everything you ask (and then some) and also produces high quality graphs as well (which can be copied and pasted into other apps in a variety of formats). Best of all, it's free and you probably already have it. It plots both discrete data sets as well as true functions. And yes, it will do linear regressions (and power, exponential, polynomial, and "custom" ones as well).
    Unfortunately, iWork's charting abilities are best described as "laughably pathetic." In stead of revolutionizing the charting aspect of spreadsheets, Apple chose to follow in M$'s footsteps, aka the path of a sado-masochistic CPA or "the Excel way." In essence, Numbers is only capable of producing what I call "bin count" charts (as in pie charts, bar graphs, and line/area charts). The "scatterplots" Numbers produces are really a hacked version of bin count charts. As such, they are basically useless for real scientific/engineering/mathematic plots. In fact, it does them so badly, I'm surprised the "scatterplot" option even made the cut for the final release.
    Things that breaks/cripples Numbers' "scatterplot":
    • No control over range of axis. "Value Axis Format" controls don't function properly/always remain blank and there is only one set of values for both axis (just like a bin count chart, whose "x axis" has no real, numerical value; so, doesn't need any controls). And there is no way to lock the scale of the axis so, for example, 10 units on the x axis is the same physical distance as 10 units on the y axis.
    • Axis grid divisions are only allow to be integers between 1 and 10 (which only makes sense for a bin count plot).
    • No 3D, log, log-log, ln, ln-ln, cylindrical, or spherical plots.
    • No true function plots. And there is no way to connect points, it only plots discrete data sets.
    • No control of data point marker sizes, only the fill/outline color and outline thickness.
    • Chart legend gets it's text from the independant variable (aka x values) column title, not the dependant (y value) column title, like it should. (Something that only makes sense on a bin count chart, which usually only have one column of data per data set.)
    • Each data set must come from adjacent pairs of columns. (You can't have one set of x values for a table of multiple y values.)
    • No way to control the size of the plot area itself (only the overall size of the chart rectangular area, which includes the axis text). So you can't fake a line chart as an overlay over a scatterplot, there's no way to align them.
    • Only does linear regressions directly (and then you have to put it together from pieces). No exponential, log, ln, power, or polynomial fits.
    • Charting brings Numbers to it's knees as far as speed is concerned.
    • I haven't found a way to ADD a data set to chart, it always seems to replace the data already plotted (or am I missing something or fighting a bug?).
    Heck, there isn't even error bars on it's financial charts, so you can't even do a simple high-low-close stock price tracking, line chart. Other than that, it you want a 2 1/2D pie chart with wood grain texturing, Apple's got you covered!
    Scott
    P.S. Just in case those of you reading this think I'm an Apple/Numbers hater, you couldn't be more wrong. I'm a huge fan of Numbers and it has permanently bumped Excel off of my dock. (I just don't use it for charting.) I call'em like I see 'em. And Apple can't fix it if they don't know it's broken.

  • Best fit line

    regarding a graph made from spreadsheet data...
    how do i make a best fit line to a set of points?
    also, is there a way to find the slope and intercept of this line?
    Thank you!

    Hello
    The named functions are not available in AppleWorks.
    One way to mimic them is to use AppleScripts .
    Here is an old one which calculate the slope.
    --{SCRIPT}
    tell application "AppleWorks 6"
    activate
    tell front document
    set laSelection to get object specifier of the selection
    set debutCible to name of first cell of laSelection
    -- nom de la première cellule cible
    -- • name of first dest cell
    set premColonne to item 1 of (index of first column of laSelection) as list
    set premRangee to item 1 of (index of first row of laSelection) as list
    set dernColonne to item 1 of (index of last column of laSelection) as list
    set dernRangee to item 1 of (index of last row of laSelection) as list
    set nb_Rangees to dernRangee - premRangee + 1
    if not (dernColonne - premColonne) = 1 then error 8088
    set cell11 to name of row premRangee of column premColonne
    set cell12 to name of row dernRangee of column premColonne
    set cell21 to name of row premRangee of column dernColonne
    set cell22 to name of row dernRangee of column dernColonne
    set vX to get select (cells cell11 thru cell12)
    set the clipboard to vX
    set vY to get select (cells cell21 thru cell22)
    set nb to count of vX
    set {X, Y, XY, x2} to {0, 0, 0, 0}
    repeat with i from 1 to nb
    set xi to vX's item i
    set yi to vY's item i
    set X to X + xi
    set Y to Y + yi
    set XY to XY + (xi * yi)
    set x2 to x2 + (xi * xi)
    end repeat
    set slope to (XY - (X * Y) / nb) / (x2 - (X * X) / nb)
    select menu item 4 of menu 3 (* copier *)
    set slope to my calcule(nb_Rangees)
    display dialog "" & slope
    end tell
    end tell
    on calcule(nb_)
    tell application "AppleWorks 6"
    activate
    set AWversion to (version as text)
    select menu item 2 of menu item 1 of menu 2 (* Nouveau tableur
    • New spreadsheet *)
    tell front document
    select cell "A1"
    select menu item 5 of menu 3 (* Colle • Paste *)
    set formula of cell "C1" to "=A1*B1"
    set formula of cell "D1" to "=A1^2"
    select cell ("C1..D" & nb_)
    select menu item 3 of menu 5 (* Recopier vers le bas
    • Fill down *)
    if AWversion starts with "FU1-" then
    set formula of cell "E1" to "=(SOMME(C1..C" & nb_ & ")-SOMME(A1..A" & nb_ & ")*SOMME(B1..B" & nb_ & ")/NOMBRE(A1..A" & nb_ & "))/(SOMME(D1..D" & nb_ & ")-SOMME(A1..A" & nb_ & ")^2/NOMBRE(A1..A" & nb_ & "))"
    else
    set formula of cell "E1" to "=(SUM(C1..C" & nb_ & ")-SUM(A1..A" & nb_ & ")*SUM(B1..B" & nb_ & ")/count(A1..A" & nb_ & "))/(SUM(D1..D" & nb_ & ")-SUM(A1..A" & nb_ & ")^2/count(A1..A" & nb_ & "))"
    end if
    set slope_ to cell "E1"
    end tell
    close document 1 without saving
    end tell
    return {slope_}
    end calcule
    --{/SCRIPT}
    Yvan KOENIG (from FRANCE mercredi 1 août 2007 06:51:46)
    edit:
    When I edit my message, the script appears but when I look in the forum it doesn't appear.
    It appears that it is a recent "feature" of this forum;
    I made a last attempt.
    If it doesn't work, you may send a mail to
    koenig then a dot then yvan then an @ then tele2 then a dot then fr
    I will send you the script as a mail attachment.
    Yvan KOENIG (from FRANCE mercredi 1 août 2007 07:07:17)
    Message was edited by: KOENIG Yvan

  • How do I make a best fit line on a scatter plot?

    I have a set of data and I made a scatter plot on numbers, but how do I put a best fit line in there?

    select the graph, then open the Charts Inspector.
    Open the series section (from the options at the top "Chart", "Axis", "Series"), Then select the "Trendline" in the "Advanced" section near the bottom.  Finally select the type of trendline

  • Best fit Line on scatter chart

    Hi,
    I am trying to draw best fit line over two points using the formula y=mx+c.
    I have the following data,
    consider x=68, y=23 and a=82, b=30
    I interchanged the above values and form the points to plot
    basically using the above (x,y,a and b) I constructed (x,y),(a,y),(x,b) as points to plot.
    68,23 (x,y)
    82,23 (a,y)
    68,30 (x,b)
    I created a scatter chart based on the value, Now I want to draw the line only between (a,y) and (x,b).
    Is this achievable using any other chart or ways?
    Any help highly appreciated.
    Thanks,
    Vino

    Hi,
    Any input on this please.
    Thanks,
    Vino

  • Other lines parallel to a Best fit line on a scatter graph?

    Can you put Lines of equal gradient to the best fit line on a scatter graph going through to points furthest above and below the best fit line?

    Simplified a bit so I am not so ashamed
    I2=SLOPE(C2:C9,B2:B9)
    I3=INTERCEPT(C2:C9,B2:B9)
    Y Linear (column D) =$I$3+B2×$I$2
    Y - YLinear (column G) is what it says
    Max Line (column E) = $D2+MAX(G)
    Min Line (column F) = =$D2+MIN(G)
    You have to format the "trend" lines with connecting lines and no data symbol

  • Is it possible to do best fit line in chart in numbers

    is it possible to do best fit line in chart in numbers

    Hi R,
    This is a Scatter Plot in Numbers 3.1. Data are in Body Columns, not Header Columns.
    Click on the chart, then Format Panel > Series > Trendlines
    Choose a Trendline. You may click on Show Equation and Show R2 (R squared).
    Regards,
    Ian.

  • This is regarding printing vertical lines for each and every field

    Hi to all.....
    1....Hi
    here is a requirement
    i want to print vertical lines and horizontal lines for each and every field in the output of a report.Here i want to see the output just like table i.e i want to draw line after each field.
                             suppose if the output list contains just 10 records, then the vertical line must end for 10 records.how to draw vertical lines for this requirement.
    thanks and regards,
    k.swaminath

    Hi
    In report you can use
    sy-uline for horizontal line
    sy-vline for vertical lines.
    Check this sample report
    DATA: BEGIN OF USR_TABL OCCURS 0.
    INCLUDE STRUCTURE UINFO.
    DATA: END OF USR_TABL.
    DATA: L_LENGTH TYPE I,
    T_ABAPLIST LIKE ABAPLIST OCCURS 0 WITH HEADER LINE, BEGIN OF T_USER OCCURS 0, COUNTER TYPE I, SELECTION TYPE C, MANDT LIKE SY-MANDT, BNAME LIKE SY-UNAME, NAME_FIRST LIKE V_ADRP_CP-NAME_FIRST, NAME_LAST LIKE V_ADRP_CP-NAME_LAST, DEPARTMENT LIKE V_ADRP_CP-DEPARTMENT, TEL_NUMBER LIKE V_ADRP_CP-TEL_NUMBER, END OF T_USER, L_CLIENT LIKE SY-MANDT, L_USERID LIKE UINFO-BNAME, L_OPCODE TYPE X, L_FUNCT_CODE(1) TYPE C, L_TEST(200) TYPE C.
    L_OPCODE = 2.
    CALL ‘ThUsrInfo’ ID ‘OPCODE’ FIELD L_OPCODE
    ID ‘TAB’ FIELD USR_TABL-*SYS*.
    CLEAR T_USER. REFRESH T_USER.
    LOOP AT USR_TABL.
    T_USER-MANDT = USR_TABL-MANDT. T_USER-BNAME = USR_TABL-BNAME. APPEND T_USER.
    ENDLOOP.
    SORT T_USER.
    DELETE ADJACENT DUPLICATES FROM T_USER.
    LOOP AT T_USER.
    T_USER-COUNTER = SY-TABIX. SELECT V~NAME_FIRST V~NAME_LAST V~DEPARTMENT V~TEL_NUMBER INTO (T_USER-NAME_FIRST, T_USER-NAME_LAST, T_USER-DEPARTMENT, T_USER-TEL_NUMBER) FROM USR21 AS U JOIN V_ADRP_CP AS V ON U~PERSNUMBER = V~PERSNUMBER AND U~ADDRNUMBER = V~ADDRNUMBER WHERE U~BNAME = T_USER-BNAME. ENDSELECT. MODIFY T_USER.
    ENDLOOP.
    SORT T_USER BY NAME_LAST NAME_FIRST.
    PERFORM DISPLAY_LIST.
    TOP-OF-PAGE.
    PERFORM DISPLAY_MENU.
        * End of top-of-page
    TOP-OF-PAGE DURING LINE-SELECTION.
    PERFORM DISPLAY_MENU.
        * End of top-of-page during line-selection
    AT LINE-SELECTION.
    IF SY-CUROW = 2. IF SY-CUCOL < 19. T_USER-SELECTION = ‘X’. MODIFY T_USER TRANSPORTING SELECTION WHERE SELECTION = ‘’. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 36. CLEAR T_USER-SELECTION. MODIFY T_USER TRANSPORTING SELECTION WHERE SELECTION = ‘X’. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 50. PERFORM TRANSFER_SELECTION. PERFORM POPUP_MSG. ELSEIF SY-CUCOL < 67. PERFORM TRANSFER_SELECTION. SORT T_USER BY NAME_LAST. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 81. PERFORM TRANSFER_SELECTION. SORT T_USER BY NAME_FIRST. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 93. PERFORM TRANSFER_SELECTION. SORT T_USER BY MANDT. PERFORM DISPLAY_LIST. ENDIF. ENDIF.
        * End of line-selection
    *& Form DISPLAY_LIST
    FORM DISPLAY_LIST.
    SY-LSIND = 0.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    LOOP AT T_USER.
    WRITE: / SY-VLINE, T_USER-SELECTION AS CHECKBOX, SY-VLINE, T_USER-MANDT, SY-VLINE, T_USER-BNAME, SY-VLINE, T_USER-NAME_FIRST(15), SY-VLINE, T_USER-NAME_LAST(15), SY-VLINE, T_USER-DEPARTMENT, SY-VLINE, T_USER-TEL_NUMBER(20), SY-VLINE. HIDE: T_USER-COUNTER, T_USER-SELECTION.
    ENDLOOP.
    FORMAT COLOR OFF.
    WRITE: /(108) SY-ULINE.
    ENDFORM. ” DISPLAY_LIST
    *& Form DISPLAY_MENU
    FORM DISPLAY_MENU.
    FORMAT COLOR COL_HEADING HOTSPOT. WRITE: (91) SY-ULINE, / SY-VLINE NO-GAP, (4) ICON_SELECT_ALL NO-GAP, ‘Select All’, SY-VLINE NO-GAP, (4) ICON_DESELECT_ALL NO-GAP, ‘Deselect All’, SY-VLINE NO-GAP, (4) ICON_SHORT_MESSAGE NO-GAP, ‘Send Popup’, SY-VLINE NO-GAP, (4) ICON_SORT_UP NO-GAP, ‘Last Name’ NO-GAP, SY-VLINE NO-GAP, (4) ICON_SORT_UP NO-GAP, ‘First Name’ NO-GAP, SY-VLINE NO-GAP, (4) ICON_SORT_UP NO-GAP, ‘Client’ NO-GAP, SY-VLINE, /(91) SY-ULINE, /(108) SY-ULINE. FORMAT HOTSPOT OFF. WRITE: / SY-VLINE, ’ ‘, SY-VLINE, ‘Cli’, SY-VLINE, ‘User ‘, SY-VLINE, ‘First Name ‘, SY-VLINE, ‘Last Name ‘, SY-VLINE, ‘Department ‘, SY-VLINE, ‘Telephone ‘, SY-VLINE, /(108) SY-ULINE. FORMAT COLOR OFF.
    ENDFORM. ” DISPLAY_MENU
    *& Form TRANSFER_SELECTION
    FORM TRANSFER_SELECTION.
    DO. READ LINE SY-INDEX FIELD VALUE T_USER-SELECTION. IF SY-SUBRC <> 0. EXIT. ENDIF. MODIFY T_USER TRANSPORTING SELECTION WHERE COUNTER = T_USER-COUNTER. ENDDO. CLEAR T_USER.
    ENDFORM. ” TRANSFER_SELECTION
    *& Form POPUP_MSG
    FORM POPUP_MSG.
    DATA: L_MSG LIKE SM04DIC-POPUPMSG VALUE ‘Experimental Message’, L_LEN TYPE I, L_RET TYPE C. LOOP AT T_USER WHERE SELECTION = ‘X’. PERFORM GET_MESSAGE CHANGING L_MSG L_RET. EXIT. ENDLOOP. IF L_RET = ‘A’. “User cancelled the message EXIT. ENDIF.
        * Get the message text
    L_LEN = STRLEN. LOOP AT T_USER WHERE SELECTION = ‘X’. CALL FUNCTION ‘TH_POPUP’ EXPORTING CLIENT = T_USER-MANDT USER = T_USER-BNAME MESSAGE = L_MSG MESSAGE_LEN = L_LENGTH
        * CUT_BLANKS = ’ ’
    EXCEPTIONS USER_NOT_FOUND = 1 OTHERS = 2. IF SY-SUBRC <> 0. WRITE: ‘User ‘, T_USER-BNAME, ‘not found.’. ENDIF. ENDLOOP. IF SY-SUBRC <> 0.
        * Big error! No user has been selected.
    MESSAGE ID ‘AT’ TYPE ‘E’ NUMBER ‘315’ WITH ‘No user selected!’. EXIT. ENDIF.
    ENDFORM. ” POPUP_MSG
    *& Form GET_MESSAGE
    FORM GET_MESSAGE CHANGING P_L_MSG LIKE SM04DIC-POPUPMSG
    P_RETURNCODE TYPE C.
    DATA: BEGIN OF FIELDS OCCURS 1. INCLUDE STRUCTURE SVAL.
    DATA: END OF FIELDS, RETURNCODE TYPE C.
    FIELDS-TABNAME = ‘SM04DIC’.
    FIELDS-FIELDNAME = ‘POPUPMSG’.
    FIELDS-FIELDTEXT = ‘Message :’. CONCATENATE ’ – Msg from’ SY-UNAME ‘.’ INTO FIELDS-VALUE SEPARATED BY ’ ‘. APPEND FIELDS.
    CALL FUNCTION ‘POPUP_GET_VALUES’
    EXPORTING POPUP_TITLE = ‘Supply the popup message’
    IMPORTING RETURNCODE = P_RETURNCODE
    TABLES FIELDS = FIELDS.
    IF P_RETURNCODE = ‘A’.
    EXIT.
    ELSE.
    READ TABLE FIELDS INDEX 1.
    P_L_MSG = FIELDS-VALUE.
    ENDIF.
    ENDFORM. ” GET_MESSAGE
    *—End of Program
    Regards
    Pavan

  • Phase shift between a pulse and sin wave

    Hello,
    I was wondering if there is any VI that I can use to get the phase shift between a pulse and a sin wave (they have same frequency).
    The Ideal case is that the pulse should go to 1 when sin wave is positive and goes to 0 when the sin wave is negative. I want to set this test to measure the phase shift between pulse going to one and sin wave going positive.
    We just bought labview full version with Signal processing package, and I was wondering if there is anything that would be useful for me.
    Thanks in advance,
    Baran.

    Hi Baran,
    Try this on for size and see if it works for you.
    Have a great day,
    Chris V
    Applications Engineer
    National Instruments
    Attachments:
    Phase Difference.vi ‏22 KB

  • Sine pattern and sine wave VI

    i would like to give input arguments to Sine pattern VI and Sine wave VI. Input argument amplitude i would like to give in mm and frequency i would like to give in HZ and periods and i also want to give time as an input. Is it possible? and how? please tell me.
    Regards

    The amplitude input is without units. For example, if you specify 3, then the sine wave values will be from -3 to 3. If you want mm, there must be some kind of conversion. When you say mm, how does this relate to the sine wave? Are you generating a sine wave voltage signal that drives a motor or other actuator that moves a device by a number of mm? Of so what is the relationship between voltage and the mm displacement generated by your actuator?
    Sine Pattern has an input for number of cycles instead of frequency. So you need to figure out how many samples you want in your waveform and how many cycles this should represent. All this depends on the update rate you use for outputing your waveform to the actuator.
    For example, if you want to update your
    output at 1 kHz, choose to have a 100 sample waveform, and want a 20 Hz sine wave -> 100 samples will represent 0.1 seconds of data (at 1 kHz). So 0.1 seconds of a 20 Hz sine signal will include 2 cycles, so you should specify 2 cycles and 100 sample on the Sine Pattern VI inputs.
    The Sine Wave VI frequency input is a bit more complicated as it is a normalized frequency input. Basically, figure out how many cycles you want. Then divide the # of cycles by the number of samples in the waveform you are generating and that is the normalized frequency you should specify. In our previous example, take 2 (# of cycles) and divide by 100 (samples in the waveform we generate). This gives you a normalized frequency of 0.02. This is the input for f (normalized frequency) on Sine Wave VI.
    Christian L
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Maybe you are looking for