Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. %John Tran 25999001 FYP 2018
  2. clc
  3. clear
  4. close all
  5.  
  6. Qa = 5; %Number of "receive" antennas
  7. Qa_t = (Qa-1)/2; %Qa bar
  8. Qb = 11; %Number of "receive" antennas
  9. Qb_t = (Qb-1)/2; %Qb bar
  10. t0_a = -0.23; %theta_0, corresponds to the physical location of a physical scatterer
  11. t0_b = 0.13; %theta_0
  12.  
  13. %Values used to plot the graphs
  14. theta = linspace(-0.5,0.5,1000);
  15. qa = linspace(-Qa_t,Qa_t,Qa);
  16. qb = linspace(-Qb_t,Qb_t,Qb);
  17.  
  18. xa = theta-t0_a;
  19. xqa = (qa./Qa)-t0_a; %uniform sampling of xa
  20. xb = theta-t0_b;
  21. xqb = (qb./Qb)-t0_b; %uniform sampling of xb
  22.  
  23. %Graph a
  24. J = (1/(Qa))*(exp(-1i*2*pi*xa*Qa_t));
  25. f_Qa=J.*(sin(pi*Qa*xa)./sin(pi*xa));
  26.  
  27. %Corresponds to samples at the virtual angle
  28. f_qa = (1/(Qa)).*(exp(-1i.*2.*pi.*xqa.*Qa_t)).*(sin(pi.*Qa.*xqa)./sin(pi.*xqa));
  29.  
  30. %Graph b
  31. K = (1/(Qb))*(exp(-1i*2*pi*xb*Qb_t));
  32. f_Qb = K.*sin(pi*Qb*xb)./sin(pi*xb);
  33.  
  34. %Corresponds to samples at the virtual angle
  35. f_qb = (1/(Qb)).*(exp(-1i.*2.*pi.*xqb.*Qb_t)).*(sin(pi.*Qb.*xqb)./sin(pi.*xqb));
  36.  
  37. %% Plots
  38. %a
  39. figure()
  40. hold on
  41. plot(theta, abs(f_Qa))
  42. ylabel('|f_Q(\theta - \theta_0)|')
  43. xlabel('\theta')
  44. title('plot a, \theta_0 = -0.23, Q = 5')
  45.  
  46. plot((qa./Qa),abs(f_qa),'*')
  47. xlim([-0.5 0.5])
  48. set(gca,'XTick',-0.5:0.1:0.5)
  49. legend('|f_Q(\theta - \theta_0)|','|f_Q(q/Q - \theta_0)|')
  50.  
  51. %b
  52. figure()
  53. hold on
  54. plot(theta, abs(f_Qb))
  55. ylabel('|f_Q(\theta - \theta_0)|')
  56. xlabel('\theta')
  57. title('plot b, \theta_0 = 0.13, Q = 11')
  58.  
  59. plot((qb./Qb),abs(f_qb),'*')
  60. xlim([-0.5 0.5])
  61. set(gca,'XTick',-0.5:0.1:0.5)
  62. legend('|f_Q(\theta - \theta_0)|','|f_Q(q/Q - \theta_0)|')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement