How about this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
t1 = 0.0005;
t2 = .008;
t3 = .0087;
t4 = 0.0161;
t = linspace(0, .018, 300);
period1 = (t2-t1) * 2;
period2 = (t4-t3) * 2;
ipv1 = sin(2 * pi * (t - t1) / period1);
subplot(3, 1, 1);
plot(t, ipv1, 'b-', 'LineWidth', 2);
grid on;
ipv2 = sin(2 * pi * (t - t4) / period2);
subplot(3, 1, 2);
plot(t, ipv2, 'b-', 'LineWidth', 2);
grid on;
% Make output array
ipv = zeros(1, length(t));
% Assign hump from curve 1 to it.
indexRange1 = ipv1 >= 0 & t >= t1 & t <= t2;
ipv(indexRange1) = ipv1(indexRange1);
% Assign hump from curve 2 to it.
indexRange2 = ipv2 <= 0 & t >= t3 & t <= t4;
ipv(indexRange2) = ipv2(indexRange2);
subplot(3, 1, 3);
plot(t, ipv, 'b-', 'LineWidth', 2);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')