Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. type = '';
  2. xn = 0:2*pi;
  3.  
  4. while type ~= "symbolic" && type ~= "numeric"
  5. type = lower(input("Symbolic or Numeric Integration?\n", 's'));
  6. end
  7.  
  8. syms x
  9. form = cos(x)*(sin(x))^3;
  10. y = cos(xn).*(sin(xn)).^3;
  11.  
  12.  
  13. switch type
  14. case 'symbolic'
  15. F = int(form);
  16. disp(F);
  17. case 'numeric'
  18. F = int(form);
  19. Fvpa = vpa(F);
  20. disp(Fvpa);
  21. end
  22.  
  23. figure(3)
  24. hold on
  25. plot(xn, y);
  26. fplot(F, [0 2*pi]);
  27.  
  28. legend('f(x)','Integral of f(x)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement