% % my_jump.m -- djm, 21 june 2005 % % - based on sara's exercise clc close all % points d = pi/200; x = -pi:d:pi; % jump function j = x/pi; j(1) = 0; j(401) = 0; % function with a jump @ a point f(1:300) = sin(x(1:300)); f(301:401) = sin(x(301:401)) + 2; % repaired? g = f + [j(101:401) j(1:100)] - j; figure(1); clf subplot(2,1,1) plot(x,f,'.') title('\bf a sine with two jumps decomposed ...') subplot(2,1,2); hold on plot(x,-[j(101:401) j(1:100)],'k.') plot(x,j,'r.') title('\bf ... into 2 shifted jumps + continuous, periodic part') plot(x,g,'b.') %title('\bf continuous & periodic part')