Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function y = minisin( x )
- %Author:Fardin Mohammed 273190
- %MINISIN approximates the sin(x)
- % X - is a vector and Y - is a vector of the same size as x
- %right now it works only for scalar x
- y =x;
- n = 1;
- count = 0;
- while max( abs( y ) ) < eps
- count=count+1;
- y = y + y.*( ( -1 )^( count+1 ) ).*( ( x.^n )/factorial( n ) );
- n=n+2;
- end
- disp(y);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement