Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DONT USE POINTERS OR VECTORS x y 0 4.835 0.04 4.92 0.1 5.143 0.12 5.227 0.22 5.591 0.24 5.638 0.26 5.704 0.32 5.906 0.34 6.023
DONT USE POINTERS OR VECTORS x y 0 4.835 0.04 4.92 0.1 5.143 0.12 5.227 0.22 5.591 0.24 5.638 0.26 5.704 0.32 5.906 0.34 6.023 0.36 6.026 0.42 6.262 0.44 6.331 0.46 6.399 0.52 6.614 0.58 6.86 0.6 6.872 0.62 6.98 0.64 7.025 0.7 7.3 0.72 7.323 0.8 7.631 0.82 7.654 0.84 7.77 0.9 7.91 1 8.256 1.08 8.556 1.1 8.615 1.12 8.715 1.14 8.777 1.16 8.873 1.22 9.106 1.24 9.119 1.34 9.476 1.48 9.958 1.5 10.032 1.52 10.083 1.54 10.171 1.58 10.337 1.6 10.366 1.62 10.468 1.7 10.751 1.72 10.8 1.74 10.845 1.76 10.955 1.8 11.051 1.88 11.361 1.9 11.433 1.92 11.475 1.98 11.768 2.04 11.973 2.2 12.536 2.22 12.57 2.24 12.665 2.3 12.891 2.32 12.917 2.38 13.09 2.42 13.223 2.48 13.49 2.5 13.512 2.6 13.91 2.62 13.996 2.64 14.062 2.7 14.271 2.76 14.457 2.82 14.688 2.84 14.773 2.9 14.967 2.92 15.034 2.98 15.26 3 15.34 3.18 15.915 3.22 16.034 3.28 16.305 3.3 16.339 3.32 16.4 3.38 16.66 3.4 16.655 3.42 16.763 3.44 16.877 3.5 17.045 Goals: Developing problem-solving skills, declaring variables, reading data from a file, using loops, and using arrays and functions. Problem: Many engineering and scientific relationships can be manipulated to a format of a straight line, y- mx +b, where m is the slope of the line and b is the y intercept. However, because most measurements have some inherent error, the formula for the line may not be obvious. Therefore, linear regression may be used to determine the best fit of a line to the measured data. Linear regression uses the following two equations for calculations of slope and y-intercept. Slope- 2y-nx y) (2x) -n2(x) 2y -slope Ex y-intercept- where n is the number of (x,y) data sets that were measured. The "goodness of fit" of this straight line can be estimated by summing the square of the residuals. The residual is defined as the difference between the measured y value and the calculated y value (using the calculated slope and y-intercept) for a given x. The equation is shown below where ym is the measured goodness of fit"-Zym-y)2 y value and yc is the calculated y value. A lower"goodness of fit" value indicates a better match of the line to the data. For this assignment you write the C++ source code that uses a set of data to determine the slope and y-intercept of the line the best fits this data. The data is stored in a file called
DONT USE POINTERS OR VECTORS
x y
0 4.835
0.04 4.92
0.1 5.143
0.12 5.227
0.22 5.591
0.24 5.638
0.26 5.704
0.32 5.906
0.34 6.023
0.36 6.026
0.42 6.262
0.44 6.331
0.46 6.399
0.52 6.614
0.58 6.86
0.6 6.872
0.62 6.98
0.64 7.025
0.7 7.3
0.72 7.323
0.8 7.631
0.82 7.654
0.84 7.77
0.9 7.91
1 8.256
1.08 8.556
1.1 8.615
1.12 8.715
1.14 8.777
1.16 8.873
1.22 9.106
1.24 9.119
1.34 9.476
1.48 9.958
1.5 10.032
1.52 10.083
1.54 10.171
1.58 10.337
1.6 10.366
1.62 10.468
1.7 10.751
1.72 10.8
1.74 10.845
1.76 10.955
1.8 11.051
1.88 11.361
1.9 11.433
1.92 11.475
1.98 11.768
2.04 11.973
2.2 12.536
2.22 12.57
2.24 12.665
2.3 12.891
2.32 12.917
2.38 13.09
2.42 13.223
2.48 13.49
2.5 13.512
2.6 13.91
2.62 13.996
2.64 14.062
2.7 14.271
2.76 14.457
2.82 14.688
2.84 14.773
2.9 14.967
2.92 15.034
2.98 15.26
3 15.34
3.18 15.915
3.22 16.034
3.28 16.305
3.3 16.339
3.32 16.4
3.38 16.66
3.4 16.655
3.42 16.763
3.44 16.877
3.5 17.045
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started