MATLAB Help with Matlab Problem: Maclaurin Series

  • Thread starter Thread starter yazankinany
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion revolves around implementing a Maclaurin series in MATLAB. The main task is to create a function called "macfun" that evaluates the series for given inputs n (the number of terms) and x (the value at which to evaluate the series). The steps include setting x to π/3, calculating the actual cosine value (xactual), and estimating the cosine using the Maclaurin series (xest). Users are advised to evaluate the percent error between xactual and xest, adjusting n until the error is less than 0.001. The conversation emphasizes the need for clear implementation and error-checking in the MATLAB code to achieve accurate results.
yazankinany
Messages
2
Reaction score
0
Help in Matlab problem!

Hello guys, I really need your help in this question, it's a maclaurin series and I don't know how to do it in matlab. here is the question :
http://sphotos-a.ak.fbcdn.net/hphotos-ak-snc6/734976_2640341944275_792908261_n.jpg

I hope that you can help me ASAP :(
 
Last edited by a moderator:
Physics news on Phys.org


well...

you first implement a function, macfun, that implements and evaluates the Maclaurin series for given values of n and x (these two would be the input arguments to the function).

then

1.- you set x = π/3, then
2.- you set xactual = cos(x)
3.- then, you pick a value for n, say 1 or 2, and
4.- set xest to the value of the function macfun(n,x)
5.- then you evaluate the percent error with the formula provided and see if it is less than 0.001...

...if not, increase n by 1 and go back to step 4
 


thank you very much, I really appreciate it
 

Similar threads

Replies
32
Views
4K
Replies
1
Views
1K
Replies
5
Views
3K
Replies
4
Views
1K
Replies
2
Views
1K
Back
Top