Advertisement
MysterionCS

taylorsin

Jan 18th, 2021
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.27 KB | None | 0 0
  1. function [tsans] = taylorsin(x,n)
  2.     % Startwert und Datentyp ans
  3.     tsans = 0;
  4.     % Loop Summe
  5.     for i = 0:n
  6.         % Terme für loop
  7.         T1 = ( ( - 1 ) ^ i );
  8.         T2 = ( x ^ ( 2 * i + 1 ) );
  9.         T3 = factorial( 2 * i + 1 );
  10.         % Loop
  11.         tsans = tsans + ( T1 * ( T2 / T3 ) );
  12.     end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement