The Easiest Way to Save and Share Code Snippets on the web

Untitled

matlab

last edit: Feb, 5th 2012 | jump to bottom

  1. n=7;
  2. N=101;
  3. a=3/n;
  4. x=[];
  5. x1=[];
  6. y=[];
  7. z=[];
  8. z1=[];
  9. dx=[];
  10. ddx=[];
  11.  
  12.  
  13.  
  14.  
  15. for k=2:N;
  16. x(k)=a*sin(2*pi*n*(k-1)/100);
  17. z(k)=1.3*a*sin(4*pi*n*(k-1)/100);
  18.  
  19. end
  20.  
  21. for k=2:N-1;
  22. dx(k)=(x(k+1)-x(k-1))/2;
  23. ddx(k)=x(k+1)-2*x(k)+x(k-1);
  24. y(k)=(x(k)*dx(k))/sqrt(0.148*(dx(k))^2-0.148*x(k)*ddx(k));
  25. end
  26.  
  27. for i.html">i=1:100
  28. x1(i.html">i)=x(i.html">i+1);
  29. z1(i.html">i)=z(i.html">i+1);
  30. end
  31.  
  32. k=2:N;
  33.  
  34. subplot(221);
  35. plot(k/1.3,x1/1.3);
  36. x1
  37.  
  38. subplot(222);
  39. plot(k/1.3,y/1.3);
  40. y
  41.  
  42. subplot(223);
  43. plot(k/1.3,z1/1.3);
  44. z1
  45.  
  46.  
  47.  
46 views