Mathematically modeling a real system in C#

  • Thread starter Thread starter btb4198
  • Start date Start date
  • Tags Tags
    Modeling System
Click For Summary
SUMMARY

This discussion centers on mathematically modeling a real system using C# to fit a sine wave to data collected from a device. The user aims to predict measurements based on a sine wave fit equation, specifically using the formula y = A sin(wX) + B, where A represents amplitude and B is the vertical shift. The conversation highlights the need for more data points for accurate fitting and suggests utilizing optimization libraries available in C# or even Excel for curve fitting. The user expresses challenges in implementing the fit and understanding the underlying mathematics.

PREREQUISITES
  • Understanding of sine wave equations and parameters (A, B, w)
  • Familiarity with C# programming and NuGet package management
  • Basic knowledge of numerical optimization techniques
  • Experience with data visualization and graphing
NEXT STEPS
  • Research C# libraries for numerical optimization, such as Math.NET Numerics
  • Learn about curve fitting techniques, specifically sinusoidal fitting
  • Explore Excel's capabilities for sinusoidal curve fitting and data analysis
  • Study the mathematical principles behind sine wave fitting and data noise reduction
USEFUL FOR

Data scientists, software developers, and engineers looking to model real-world systems using mathematical functions, particularly those interested in signal processing and data analysis in C#.

  • #31
Can we see something of the results ?
 
Technology news on Phys.org
  • #32
BvU said:
Can we see something of the results ?
1633719542356.png
This is a fit that I did today. And it fit the data that I measure. it is off at little as you do down. and I think it is because I did not iterate it. I think to iterated it , I would have to solute for A B and w again . I just do not know when to stop.
 
Last edited:
  • Haha
Likes   Reactions: pbuk
  • #33
btb4198 said:
View attachment 290391This is a fit that I did today. And it fit the data that I measure. it is off at little as you do down. and I think it is because I did not iterate it. I think to iterated it , I would have to solute for A B and w again . I just do not know when to stop.
You should adjust the vertical scale on your graph. What you show here looks like nothing more than a horizontal line, ##y \approx 100##.
 
  • #34
Mark44 said:
You should adjust the vertical scale on your graph. What you show here looks like nothing more than a horizontal line, ##y \approx 100##.
I have been trying... but the graphing calculator does not let me... it is very frustrating, I am only using it because it comes with my computer .
 
  • #35
btb4198 said:
I have been trying... but the graphing calculator does not let me... it is very frustrating, I am only using it because it comes with my computer .
Try desmos instead.
 
  • #37
btb4198 said:
I have been trying... but the graphing calculator does not let me... it is very frustrating, I am only using it because it comes with my computer .
It looks like you are using the Windows Calculator to do the graphs.
Click the icon circled below to open the Graph Options dialog.
pic1.png


On the Graph Options dialog, you can change the scale on the x-axis or the y-axis, change the units (radians, degrees, or grads), or change the line thickness.
pic2.png

You'll get a more useful graph by changing the limits on the y-axis to better show the oscillation.
 
  • Like
Likes   Reactions: sysprog

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 85 ·
3
Replies
85
Views
9K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
963
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K