Friday, July 20, 2012

MATLAB - Standing Wave


stand_wave1
% ************************ STANDING WAVE ***************************
% ************************ By Mahesha MG ***************************
figure('color','white')
x=0:0.01:10;

for t=0:0.1:5
   y1=sin(2*x-1*t);
   y2=sin(2*x+1*t);
   y=y1+y2;
   plot(x,y,'b');
   hold all;
   ylim([-2 2]);
   title('Standing Wave')
   xlabel('By: Mahesha MG maheshamg@gmail.com');
   getframe;
end

3 comments:

  1. hi,thank you for this info,really appreciate..but why i get this error when i launched it.

    ??? MATLAB - Standing Wave
    |
    Error: Unexpected MATLAB expression.

    please help :)

    ReplyDelete
    Replies
    1. It is working properly in my system. copy the following to your .m file
      % ************************ STANDING WAVE ***************************
      % ************************ By Mahesha MG ***************************
      figure('color','white')
      x=0:0.01:10;

      for t=0:0.1:5
      y1=sin(2*x-1*t);
      y2=sin(2*x+1*t);
      y=y1+y2;
      plot(x,y,'b');
      hold all;
      ylim([-2 2]);
      title('Standing Wave')
      xlabel('By: Mahesha MG maheshamg@gmail.com');
      getframe;
      end

      Delete
    2. i got it..sir please check your e-mail :)

      Delete