Question
use Matlab to numerically integrate the curve using several techniques and step sizes. You should write a single script le that accomplishes all the tasks
use Matlab to numerically integrate the curve using several techniques and step sizes. You should write a single script le that accomplishes all the tasks below, possibly with supporting function les.
import the data into Matlab. You may need to convert the data le to csv format manually rst, or you may be able to read it directly in using csvread or dlmread
there are 2 n + 1 data points, such that we have 2 n segments. This means that we can integrate numerically using one segment, two, four, eight, etc. Determine the value of n.
Integrate using the regtangular rule (left or right, not both) and every possible equal step size. Store the results to a csv le, where the rst column is the vector of iteration numbers (1 to n), the second column is the vector of step sizes, the third column is the corresponding number of segments, the fourth column is the calculated integral, and the fth column is error magnitude. As with the Excel version of this assignment, the reference value is 454.550326570633. Name your le rect results.csv.
Integrate as above, but using the trapezoidal rule.
Calculate the integral for each step size using one level of Richardson extrapolation on the trapezoidal rule results, saving your results into rich1 results.csv
Write a second Matlab script which plots all your results. For error magnitude E, iteration number n, and step size x
y-semilog plot of E vs. n
second plot, this time of log(E/x m) vs. n.
data from the dat file below: (this are only 100 data point in reality I have 31770 data point
x | f(x) |
0 | 0 |
0.00019531 | 0.10569 |
0.00039063 | 0.21137 |
0.00058594 | 0.31704 |
0.00078125 | 0.4227 |
0.00097656 | 0.52836 |
0.0011719 | 0.63401 |
0.0013672 | 0.73965 |
0.0015625 | 0.84528 |
0.0017578 | 0.95091 |
0.0019531 | 1.0565 |
0.0021484 | 1.1621 |
0.0023438 | 1.2677 |
0.0025391 | 1.3733 |
0.0027344 | 1.4789 |
0.0029297 | 1.5845 |
0.003125 | 1.6901 |
0.0033203 | 1.7956 |
0.0035156 | 1.9012 |
0.0037109 | 2.0067 |
0.0039063 | 2.1122 |
0.0041016 | 2.2178 |
0.0042969 | 2.3233 |
0.0044922 | 2.4288 |
0.0046875 | 2.5343 |
0.0048828 | 2.6398 |
0.0050781 | 2.7453 |
0.0052734 | 2.8508 |
0.0054688 | 2.9562 |
0.0056641 | 3.0617 |
0.0058594 | 3.1672 |
0.0060547 | 3.2726 |
0.00625 | 3.3781 |
0.0064453 | 3.4835 |
0.0066406 | 3.5889 |
0.0068359 | 3.6943 |
0.0070313 | 3.7997 |
0.0072266 | 3.9051 |
0.0074219 | 4.0105 |
0.0076172 | 4.1159 |
0.0078125 | 4.2213 |
0.0080078 | 4.3266 |
0.0082031 | 4.432 |
0.0083984 | 4.5373 |
0.0085938 | 4.6427 |
0.0087891 | 4.748 |
0.0089844 | 4.8533 |
0.0091797 | 4.9587 |
0.009375 | 5.064 |
0.0095703 | 5.1693 |
0.0097656 | 5.2746 |
0.0099609 | 5.3798 |
0.010156 | 5.4851 |
0.010352 | 5.5904 |
0.010547 | 5.6956 |
0.010742 | 5.8009 |
0.010938 | 5.9061 |
0.011133 | 6.0114 |
0.011328 | 6.1166 |
0.011523 | 6.2218 |
0.011719 | 6.327 |
0.011914 | 6.4322 |
0.012109 | 6.5374 |
0.012305 | 6.6426 |
0.0125 | 6.7478 |
0.012695 | 6.8529 |
0.012891 | 6.9581 |
0.013086 | 7.0632 |
0.013281 | 7.1684 |
0.013477 | 7.2735 |
0.013672 | 7.3786 |
0.013867 | 7.4837 |
0.014063 | 7.5888 |
0.014258 | 7.6939 |
0.014453 | 7.799 |
0.014648 | 7.9041 |
0.014844 | 8.0092 |
0.015039 | 8.1142 |
0.015234 | 8.2193 |
0.01543 | 8.3243 |
0.015625 | 8.4294 |
0.01582 | 8.5344 |
0.016016 | 8.6394 |
0.016211 | 8.7444 |
0.016406 | 8.8494 |
0.016602 | 8.9544 |
0.016797 | 9.0594 |
0.016992 | 9.1644 |
0.017188 | 9.2694 |
0.017383 | 9.3743 |
0.017578 | 9.4793 |
0.017773 | 9.5842 |
0.017969 | 9.6892 |
0.018164 | 9.7941 |
0.018359 | 9.899 |
0.018555 | 10.004 |
0.01875 | 10.109 |
0.018945 | 10.214 |
0.019141 | 10.319 |
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