% Sami Arica. March 24, 2014 % % Example of transformation of independent variable % t = -2:0.001:3; % The following function is the same with funb.m x = @(t) (t .* double((t >= -1)&(t < 0)) + 1) .* double((t >= -1)&(t < 0)) + (-1/2 * t .* double((t >= 0)&(t < 2)) + 1) .* double((t >= 0)&(t < 2)); plot(t, x(t), 'k', 'LineWidth',2); xlabel('t [second]') ylabel('x(t)') ylim([-0.5 1.5]) t = -4:0.001:4; plot(t, x(t), '-b', t, x(t - 1), 'k', 'LineWidth',2); xlabel('t [second]') legend('x(t)', 'x(t - 1)') ylim([-0.5 1.5]) plot(t, x(t), '-b', t, x(-2*t/3 + 1/3), 'k', 'LineWidth',2); xlabel('t [second]') legend('x(t)', 'x(-2*t/3 + 1/3)') ylim([-0.5 1.5])