Let’s see a MATLAB program to calculate Maclaurin Series of order n.
MATLAB Program for Maclaurin Series
Initially, it will take input x as theta of cos. Then it will ask how many terms the series should expand. By using for loop and Maclurin Series formula it will generate the series up to the terms required.
%Maclurine series% x = input('enter value of cosx :'); n=input('enter last value:'); for i=1:n series=(((-1)^n)/(factorial(2*n)))*(x^(2*n)); series=series+series; end series
You can download this MATLAB program here.
This article is written by Gohar Jamal. I hope you liked this article. Like our facebook page and subscribe to our newsletter for future updates. If you have any queries feel free to ask in the comment section below. Have a nice day!