# Calculating minimum N so that error<10^-7 on matlab

• Daviddd
In summary, to calculate the minimum N in Matlab to achieve an error less than 10^-7, you can use the formula N = log((b-a)/e)/log(2), where a and b are the bounds of the interval and e is the desired error. Other formulas such as the Taylor series or Euler-Maclaurin formula can also be used, but the mentioned formula is commonly used in Matlab. To check the accuracy of the calculated N, you can use the linspace() function to generate a vector of equally spaced points and calculate the error at each point. If all errors are below the desired threshold, the N value is accurate enough. If not, you can try increasing the number of points or using a different formula
Daviddd

Irrelevant...

## 1. How do I calculate the minimum N in Matlab to achieve an error less than 10^-7?

To calculate the minimum N, you can use the formula N = log((b-a)/e)/log(2), where a and b are the bounds of the interval and e is the desired error. In Matlab, you can use the function log10() to calculate the base 10 logarithm and log2() to calculate the base 2 logarithm.

## 2. Can I use a different formula to calculate the minimum N?

Yes, there are other formulas that can be used to calculate the minimum N, such as the Taylor series formula or the Euler-Maclaurin formula. However, the formula mentioned above is the most commonly used in Matlab for this purpose.

## 3. How can I check if my calculated N is accurate enough?

You can use the built-in function linspace() in Matlab to generate a vector of N equally spaced points between a and b. Then, you can use this vector to calculate the error at each point and check if it is less than 10^-7. If all the errors are below the desired threshold, your N value is accurate enough.

## 4. What should I do if my calculated N is not accurate enough?

If your calculated N is not accurate enough, you can try increasing the number of points or using a different formula to calculate the minimum N. You can also check for any errors in your code or if the interval bounds are too large, which can affect the accuracy of the calculation.

## 5. Are there any limitations to using this method to calculate the minimum N?

Yes, this method assumes that the function you are evaluating is continuous and differentiable within the given interval. It also assumes that the error is evenly distributed throughout the interval. If these assumptions are not met, the calculated N may not be accurate enough.

Replies
1
Views
771
• Engineering and Comp Sci Homework Help
Replies
1
Views
486
• MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
Replies
3
Views
273
• MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
• Calculus and Beyond Homework Help
Replies
10
Views
1K
• Engineering and Comp Sci Homework Help
Replies
3
Views
1K
• Introductory Physics Homework Help
Replies
5
Views
967
• Engineering and Comp Sci Homework Help
Replies
2
Views
2K
• General Math
Replies
5
Views
1K