SHARE
TWEET

Untitled

a guest Oct 16th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc;
  2. clear all;
  3. close all;
  4.  
  5. X=[exp(1), -pi, sqrt(2), -psi(1), log10(2)];
  6. Y=[1486.2497, 878366.9879, -22.37492, 4773714.647, 0.000185049];
  7.  
  8. s=0;
  9. for i=1:length(X)
  10.     s = s + X(i)*Y(i);
  11. end
  12.  
  13. s1=0;
  14.  
  15. for i=length(X):-1:1
  16.     s1 = s1 + X(i)*Y(i);
  17. end
  18.  
  19. s2 = dot(X,Y);
  20.  
  21. s3 = X(2)*Y(2) + X(4)*Y(4) + X(1)*Y(1) + X(3)*Y(3) + X(5)*Y(5);
  22.  
  23. disp(s);
  24. disp(s1);
  25. disp(s2);
  26. disp(s3);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top