none
Spectrum display RRS feed

  • Question

  • Hi,

    I want to display frequency vs amplitude waveform in mscharts for the collected samples values. I'm not getting any ideas regarding this. Can anyone suggest me the best way to overcome this issue.

    Regards

    Teja  


    B TEJA

    Wednesday, June 13, 2018 12:33 PM

All replies

  • Hi,

    I want to display frequency vs amplitude waveform in mscharts for the collected samples values. I'm not getting any ideas regarding this. Can anyone suggest me the best way to overcome this issue.

    Regards

    Teja  


    B TEJA

    What is frequency vs amplitude? You mean time vs amplitude?

    The problem is that you have never shown us your data although we have asked you for it several times.

    You seem to have indexed data. That is you take a reading and save it. So you have readings 1, 2, 3... on the x axis and values on the y axis ie 0.5, 1.5, 3303.

    ie  Indexed x-axis

    x    y

    1    0.5

    2    1.5

    3   3303

    But what you seem to want to plot is X axis as time:

    12:22:11   0.5

    12:22:31   1.5

    12:22:52  3303

    So that is where you seem confused???? Which do you have x-axis time values or indexed values???

    I believe what you want is one of the examples I showed here:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/b06d9d73-204d-48db-b217-96abd6018be5/x-axis-as-time-format-hhmmss-with-continuous-update-for-every-sec?forum=vbgeneral

    However if you would just show us the data you want to plot then we can give you another example.

    PS show an image of what the graph should look like.

    Wednesday, June 13, 2018 2:01 PM
  • What is frequency vs amplitude? You mean time vs amplitude?

    Frequency vs amplitude would show the response (eg, the extent of the vibration) that occurs at each frequency.  A speaker cone, for example: feed it a range of frequencies and measure the amplitude of the vibration at each frequency.  If that's what OP means then it is a simple X/Y graph, possibly a point, or could be a line.
    https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/dd456684%28v%3dvs.100%29

    Wednesday, June 13, 2018 10:23 PM
  • What is frequency vs amplitude? You mean time vs amplitude?

    Frequency vs amplitude would show the response (eg, the extent of the vibration) that occurs at each frequency.  A speaker cone, for example: feed it a range of frequencies and measure the amplitude of the vibration at each frequency.  If that's what OP means then it is a simple X/Y graph, possibly a point, or could be a line.
    https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/dd456684%28v%3dvs.100%29


    I see.

    Well its still the same problem: I dont understand what the "issue" is.

    And the x axis is cycles per sec or something? But from past questions the x axis units have not defined exactly. 

    How are "the collected samples values" collected? Is the x axis indexed or is it another reading as I explained above?

    Do you follow what I mean Acamar?

    If Teja will just show the data like 5 points x, y and an example final chart image I think we can answer any questions?? 

    Do you understand Teja's question(s) Acamar?

    PS Look at Teja's past threads.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/b06d9d73-204d-48db-b217-96abd6018be5/x-axis-as-time-format-hhmmss-with-continuous-update-for-every-sec?forum=vbgeneral

    Wednesday, June 13, 2018 11:10 PM
  • Well its still the same problem: I dont understand what the "issue" is.

    Yes.  OP needs to show some data and an image of what the plot should look like.  Then it's just a matter of choosing the appropriate chart style and configuring it accordingly.

    Thursday, June 14, 2018 12:39 AM
  • Here is an example that makes 30 x, y data points between x = 0 and 1000 and saves in a list of points. Then the first image shows all 30 points between 0 to 1000 and the second chart shows points between 300 and 800.

    This chart shows all 30 points as  AxisX.Minimum and maximum are not defined.

    This chart shows the points only between x = 300 and 800 as shown in the code example below by using AxisX.Minimum and maximum as shown in the code example.

    Imports System.Windows.Forms.DataVisualization.Charting
    
    Public Class Form2
        Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
            Me.Width = 400
    
            'create 30 data pts on x axis
            Dim dataPts As New List(Of PointF)
            For i = 1 To 30
                dataPts.Add(New Point(i * 33.3, (i * 0.4) ^ 2))
            Next
    
            'setup the chart
            Chart1.ChartAreas.Clear()
            Chart1.ChartAreas.Add(New ChartArea())
    
            With Chart1.ChartAreas(0)
                .AxisX.Title = "X"
                .AxisX.MajorGrid.LineColor = Color.LightBlue
                .AxisY.Title = "Y"
                .AxisY.MajorGrid.LineColor = Color.LightGray
    
                .AxisX.ScrollBar.Enabled = True
                .CursorX.IsUserEnabled = True
                .CursorX.IsUserSelectionEnabled = True
                .AxisX.ScaleView.Zoomable = True
    
            End With
    
            'draw the chart
            Chart1.Series.Clear()
            Chart1.Series.Add("")
    
            'set the x axis range to plot points from x = 300 to 800
            Chart1.ChartAreas(0).AxisX.Minimum = 300
            Chart1.ChartAreas(0).AxisX.Maximum = 800
            Chart1.ChartAreas(0).AxisX.Interval = 50
    
            With Chart1.Series(0)
                .IsVisibleInLegend = False
                .ChartType = DataVisualization.Charting.SeriesChartType.Point
    
                'add all the points to the series
                For Each pt As PointF In dataPts
                    .Points.AddXY(pt.X, pt.Y)
                Next
    
            End With
        End Sub
    End Class



    Thursday, June 14, 2018 1:23 AM
  • Hi,

    I want to display frequency vs amplitude waveform in mscharts for the collected samples values. I'm not getting any ideas regarding this. Can anyone suggest me the best way to overcome this issue.

    Regards

    Teja  


    B TEJA

    Hi,

    what samples do you get? I assume samples in time? If so, then capture a long enough set of samples, so it could be regarded as periodic, fourier transform those samples and show the results. Repeat with the next chunk of samples, give a bit of overlap.

    See the Short Time Fourier Transform via FFT and see for a short info:

    http://scholarship.claremont.edu/cgi/viewcontent.cgi?article=1575&context=cmc_theses

    Chapter 6.2

    Regards,

      Thorsten

    Thursday, June 14, 2018 2:24 AM
  • Hi,

    Thanks for the discussion. Previous questions that I have asked in this forum are rectified. Now i was able to display the graph(colleted values vs time) with all my requirements. Now my intenstion is to display the spectrum analysis of the captured values means that i have some bulk sensor data(-40.5461551) in a list, now I want to show the same graph(time vs values) as (frequency vs amplitude) by doing some spectum analysis(FFT).

    Regards

    Teja.


    B TEJA

    Thursday, June 14, 2018 4:52 AM
  • i have some bulk sensor data(-40.5461551) in a list, now I want to show the same graph(time vs values) as (frequency vs amplitude) by doing some spectum analysis(FFT).

    It appears that the problem is that you have values for amplitude over time but you need to do the FFT to get the frequency distribution.  There are many examples of that calculation available.  See, for instance:
    http://www.extremeoptimization.com/Documentation/Reference/Extreme.Mathematics.SignalProcessing.aspx

     
    Thursday, June 14, 2018 5:04 AM
  • Hi,

    Now my working chart is as shown below. i'm trying to display in 2nd chart format.

    Regards

    Teja.


    B TEJA

    Thursday, June 14, 2018 5:06 AM

  • B TEJA

    Thursday, June 14, 2018 5:08 AM

  • B TEJA

    Thursday, June 14, 2018 5:08 AM
  • Hi Teja,

    According to your description, it seems that you resolve the issue, could you please share the solution and mark it as answer, it will be beneficial to other communities who have the similar issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 14, 2018 8:11 AM
    Moderator
  • Hi Teja,

    According to your description, it seems that you resolve the issue, could you please share the solution and mark it as answer, it will be beneficial to other communities who have the similar issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    I think perhaps Teja solved some of the earlier issues from previous questions which Teja should mark as answered now.

    This question is still active with the first chart Teja showed above as the current chart Teja is making with current code and the chart below that the result Teja wants to get with corrected code????

    So Teja wants to convert the first chart to the second chart that Teja showed. I still don't think there is enough information to do exactly something and I don't see how the first chart could be correct as the time scale seems off but maybe the sample is less than one sec long as Teja shows in first chart?

    PS I don't think ms chart control will make the drawing that Thorsten showed in the link for spectrum if that's what anyone wants (Hi Thorsten!) but might be fun to draw by hand.



    Thursday, June 14, 2018 2:38 PM