%
%  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
% UNLIKE THE PREVIOUS CODES, THIS ONE IS NOT RUNNABLE IN THE PRESENT FORM.
% YOU WILL NEED TO SUPPLY SOME OF THE COMMANDS, BORROWING THEM FROM YOUR
% ORIGINAL CODE.
%   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


% Setup of segment 1 is the same as before.

xmin_2=0.7; ymin_2=0.05; xmax_2=0.7; ymax_2=0.95;
x_2=xmin_2+(xmax_2-xmin_2)*t; y_2=ymin_2+(ymax_2-ymin_2)*t;
            % 2nd segment before it is made wavy
ax2=0.03;   % amplitude of waves of x-components of segment2
fx2=30;     % frequency of these waves; period = 2*pi/fx2
x_2_wavy=x_2 + ax2*sin(fx2*t);
            % x-component of the wavy segment2
            % Its form will be commented on after the code.
y_2_wavy=y_2; % For simplicity we assume that the y-coordinates
              %  of segment2 don't move.
            
xmin_3=0.7; ymin_3=0.95; xmax_3=0.45; ymax_3=0.8;
x_3=xmin_3+(xmax_3-xmin_3)*t; y_3=ymin_3+(ymax_3-ymin_3)*t;
            % 3rd segment before it is made wavy
ax3=0.04; fx3=5.0;   ay3=0.02;  fy3=4.5;
            % amplitudes and frequencies of waves on segment3
x_3_wavy=x_3 + ax3*sin(fx3*t);
y_3_wavy=y_3 + ay3*sin(fy3*t);
            % x- and y-components of the wavy segment3
              
xmin_4=x_3_wavy(end); ymin_4=y_3_wavy(end);
            % The upper endpoint of segment 4 is made to move 
            %  according to the motion of segment3.
xmax_4=0.45; ymax_4=0.65;
x_4=xmin_4+(xmax_4-xmin_4)*t; y_4=ymin_4+(ymax_4-ymin_4)*t;
            % 4th segment

% Setup of the 5th segment and plotting of the entire letter
%  are the same as before.