Advertisement
Guest User

Untitled

a guest
May 29th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.94 KB | None | 0 0
  1. clc
  2. clear all;
  3. syms x y
  4.  
  5.  
  6. S1 = [0, 200]';
  7. S2 = [400, 400]';
  8.  
  9. h(1,1)=sqrt((x-S1(1))^2 + (y-S1(2))^2);
  10. h(2,1)=sqrt((x-S2(1))^2 + (y-S2(2))^2);
  11. h(3,1)=atan2((x-S1(2)),(y-S1(1)));
  12. h(4,1)=atan2((x-S2(2)),(y-S2(1)));
  13.  
  14.  
  15. f11 = symfun(h(1,1), [x y]);
  16. f21 = symfun(h(2,1), [x y]);
  17. f31 = symfun(h(3,1), [x y]);
  18. f41 = symfun(h(4,1), [x y]);
  19.  
  20. value1=1;
  21. value2=2;
  22.  
  23. D1=hessian(f11,[x y]);
  24. D1_=D1(value1,value2);
  25. D1_=[D1_(1,1) D1_(1,2) 0 0;...
  26.     D1_(2,1) D1_(2,2) 0 0;...
  27.     0 0 0 0;...
  28.     0 0 0 0];
  29.  
  30. D2=hessian(f21,[x y]);
  31. D2_=D2(value1,value2);
  32. D2_=[D2_(1,1) D2_(1,2) 0 0;...
  33.     D2_(2,1) D2_(2,2) 0 0;...
  34.     0 0 0 0;...
  35.     0 0 0 0];
  36.  
  37. D3=hessian(f31,[x y]);
  38. D3_=D3(value1,value2);
  39. D3_=[D3_(1,1) D3_(1,2) 0 0;...
  40.     D3_(2,1) D3_(2,2) 0 0;...
  41.     0 0 0 0;...
  42.     0 0 0 0];
  43.  
  44. D4=hessian(f41,[x y]);
  45. D4_=D4(value1,value2);
  46. D4_=[D4_(1,1) D4_(1,2) 0 0;...
  47.     D4_(2,1) D4_(2,2) 0 0;...
  48.     0 0 0 0;...
  49.     0 0 0 0];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement