Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. function y = minisin( x )
  2. %Author:Fardin Mohammed 273190
  3. %MINISIN approximates the sin(x)
  4. % X - is a vector and Y - is a vector of the same size as x
  5. %right now it works only for scalar x
  6.  
  7. y =x;
  8. n = 1;
  9. count = 0;
  10.  
  11. while max( abs( y ) ) < eps
  12. count=count+1;
  13. y = y + y.*( ( -1 )^( count+1 ) ).*( ( x.^n )/factorial( n ) );
  14. n=n+2;
  15. end
  16.  
  17. disp(y);
  18.  
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement