Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. function y = arcsin_test3(x)
  2. y = x.*(1+x.*x.*(1/6+ x.*x.*(3/(2*4*5) + x.*x.*((1*3*5)/(2*4*6*7)))))
  3. endfunction
  4.  
  5. // 25770
  6. function y = arcsin_test(x)
  7. a0 = 1.5707288
  8. a1 = -0.2121144
  9. a2 = 0.0742610
  10. a3 = -0.0187293
  11.  
  12. xx = abs(x)
  13.  
  14. y = %pi/2 - sqrt(1-x).*(a0 + a1*x + a2.*x.*x + a3.*x.*x.*x)
  15.  
  16. endfunction
  17.  
  18. function y = arcsin_test2(x)
  19. a0 = 1.5707288
  20. a1 = -0.2121144
  21. a2 = 0.0742610
  22. a3 = -0.0187293
  23.  
  24. xx = abs(x)
  25.  
  26. y = %pi/2 - sqrt(1-xx).*(a0 + a1*xx + a2.*xx.*xx + a3.*xx.*xx.*xx)
  27.  
  28. y = y.*sign(x);
  29. endfunction
  30.  
  31. x = [-1: .0100001 : 1];
  32.  
  33. clf
  34. subplot(211)
  35. plot(x,arcsin_test2(x),'g.');
  36. plot(x,arcsin_test(x),'r:');
  37. plot(x,asin(x))
  38. subplot(212)
  39. //plot(x,(arcsin_test(x) - asin(x)),'r:')
  40. plot(x,(arcsin_test2(x) - asin(x)),'g.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement