Home > database >  How to use matlab to implement the dynamic process of standing wave form?
How to use matlab to implement the dynamic process of standing wave form?

Time:11-21

How to use matlab to implement the dynamic process of standing wave form?

CodePudding user response:

The clear
Xm=2;
Dx=0.01;
X=0: dx: xm;
U1=cos (2 * PI * x);
U2=u1;
% u2=u1 * 0.8;
% u2=u1 * 1.2;
U=u1 + u2. % VSWR
Figure % create graphics window
H=the plot (x, u, 'r', 'our LineWidth, 2); % standing wave handle
% h=the plot (x, u, 'r', 'our LineWidth, 2,' erasemode ', 'xor); % standing wave handle
The axis ([0, xm, 3, 3])
% curve rangeThe grid on the % and grid
Fs=16; % font size
Xlabel (' \ itx/\ lambda ', 'FontSize, fs) % x
tagsYlabel (' \ itu/A ', 'FontSize, fs) % y tag
The title (' the formation of standing wave ', 'FontSize, fs) % title
% title (' synthetic right wave ', 'FontSize, fs) % title
% title (' synthetic left traveling wave ', 'FontSize, fs) % title
Hold on % in
H1=plot (x, u1, 'our LineWidth, 2);
H2=plot (x, u2, 'k', 'our LineWidth, 2);
% h1=plot (x, u1, 'our LineWidth, 2,' erasemode ', 'xor);
H2=plot (x, u2, 'k', 'our LineWidth, 2,' erasemode ', 'xor); % l wave handle
Ht1=text (1, Max + 0.1 (u1), '\ rightarrow', 'FontSize, fs); % show the arrow to the right the
Ht2=text (1, Max + 0.2 (u2), '\ leftarrow', 'FontSize, fs); % show the arrow to the right the
Pause
While 1
% while get (GCF, 'CurrentCharacter') ~=char (27) % does not press the ESC key circulation
U1=[u1 (end - 1), u1 (1: end - 1)];
U2=[u2 (2: end), u2 (2)];
U=u1 + u2. % composite wave
Set (h1, 'YData, u1)
Set (h2, 'YData, u2)
Set (h, 'YData, u)
Um, I]=Max (u1);
Set (ht1, 'Position,] [x (I), um + 0.1) % set the Position of the right arrow
Um, I]=Max (u2);
Set (ht2, 'Position,] [x (I), um + 0.2) % sets the Position of the left arrow
Drawnow
Pause (0.1)
If the get (GCF, 'CurrentCharacter')==char (27) break; Pressing ESC exit the program end %
end

CodePudding user response:

The
1/f, reference & lt; Span style="color: # 4788 c7" & gt; Robby - fans' & lt;/span> Response:
clear
Xm=2;
Dx=0.01;
X=0: dx: xm;
U1=cos (2 * PI * x);
U2=u1;
% u2=u1 * 0.8;
% u2=u1 * 1.2;
U=u1 + u2. % VSWR
Figure % create graphics window
H=the plot (x, u, 'r', 'our LineWidth, 2); % standing wave handle
% h=the plot (x, u, 'r', 'our LineWidth, 2,' erasemode ', 'xor); % standing wave handle
The axis ([0, xm, 3, 3])
% curve rangeThe grid on the % and grid
Fs=16; % font size
Xlabel (' \ itx/\ lambda ', 'FontSize, fs) % x
tagsYlabel (' \ itu/A ', 'FontSize, fs) % y tag
The title (' the formation of standing wave ', 'FontSize, fs) % title
% title (' synthetic right wave ', 'FontSize, fs) % title
% title (' synthetic left traveling wave ', 'FontSize, fs) % title
Hold on % in
H1=plot (x, u1, 'our LineWidth, 2);
H2=plot (x, u2, 'k', 'our LineWidth, 2);
% h1=plot (x, u1, 'our LineWidth, 2,' erasemode ', 'xor);
H2=plot (x, u2, 'k', 'our LineWidth, 2,' erasemode ', 'xor); % l wave handle
Ht1=text (1, Max + 0.1 (u1), '\ rightarrow', 'FontSize, fs); % show the arrow to the right the
Ht2=text (1, Max + 0.2 (u2), '\ leftarrow', 'FontSize, fs); % show the arrow to the right the
Pause
While 1
% while get (GCF, 'CurrentCharacter') ~=char (27) % does not press the ESC key circulation
U1=[u1 (end - 1), u1 (1: end - 1)];
U2=[u2 (2: end), u2 (2)];
U=u1 + u2. % composite wave
Set (h1, 'YData, u1)
Set (h2, 'YData, u2)
Set (h, 'YData, u)
Um, I]=Max (u1);
Set (ht1, 'Position,] [x (I), um + 0.1) % set the Position of the right arrow
Um, I]=Max (u2);
Set (ht2, 'Position,] [x (I), um + 0.2) % sets the Position of the left arrow
Drawnow
Pause (0.1)
If the get (GCF, 'CurrentCharacter')==char (27) break; Pressing ESC exit the program end %
End
& lt; Br/& gt; The simulated seemed to also can't move, only two arrows pointing, but not fluctuate

CodePudding user response:

refer to the second floor m0_47974888 response:
Quote: 1/f, reference & lt; Span style="color: # 4788 c7" & gt; Robby - fans' & lt;/span> Response:
clear
Xm=2;
Dx=0.01;
X=0: dx: xm;
U1=cos (2 * PI * x);
U2=u1;
% u2=u1 * 0.8;
% u2=u1 * 1.2;
U=u1 + u2. % VSWR
Figure % create graphics window
H=the plot (x, u, 'r', 'our LineWidth, 2); % standing wave handle
% h=the plot (x, u, 'r', 'our LineWidth, 2,' erasemode ', 'xor); % standing wave handle
The axis ([0, xm, 3, 3])
% curve rangeThe grid on the % and grid
Fs=16; % font size
Xlabel (' \ itx/\ lambda ', 'FontSize, fs) % x
tagsYlabel (' \ itu/A ', 'FontSize, fs) % y tag
The title (' the formation of standing wave ', 'FontSize, fs) % title
% title (' synthetic right wave ', 'FontSize, fs) % title
% title (' synthetic left traveling wave ', 'FontSize, fs) % title
Hold on % in
H1=plot (x, u1, 'our LineWidth, 2);
H2=plot (x, u2, 'k', 'our LineWidth, 2);
% h1=plot (x, u1, 'our LineWidth, 2,' erasemode ', 'xor);
H2=plot (x, u2, 'k', 'our LineWidth, 2,' erasemode ', 'xor); % l wave handle
Ht1=text (1, Max + 0.1 (u1), '\ rightarrow', 'FontSize, fs); % show the arrow to the right the
Ht2=text (1, Max + 0.2 (u2), '\ leftarrow', 'FontSize, fs); % show the arrow to the right the
Pause
While 1
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related