Keywords: Square signal and its antiderivatives.svg en Square signal and its antiderivatives fr Un signal carré et ses primitives 2012-09-24 15 37 20 own Gapato Python scipy/numpy/matplotlib code from matplotlib pyplot import from numpy import from scipy integrate import cumtrapz def f x return x sin 1/x eps 1e-9 x0 linspace 0 1-eps 100 x1 linspace 1 2-eps 100 x2 linspace 2 3-eps 100 int_x0 1-2 mod modf x0 1 2 int_x1 1-2 mod modf x1 1 2 int_x2 1-2 mod modf x2 1 2 x hstack x0 x1 x2 int_x hstack int_x0 int_x1 int_x2 first_prim cumtrapz int_x x initial 0 second_prim cumtrapz first_prim x initial 0 plot x0 int_x0 color 'blue' lw 2 plot x1 int_x1 color 'blue' label r' f x - \lfloor x \rfloor\ \mathrm mod \ 2 + 1 ' lw 2 plot x2 int_x2 color 'blue' lw 2 plot x first_prim color 'red' label r' F x \int_0 x f t dt ' lw 2 plot x second_prim color 'green' label r' \int_0 x F t dt ' lw 2 ylim -1 1 1 6 axhline 0 color 'gray' legend loc 3 bbox_to_anchor 0 0 1 tight_layout show cc-zero Uploaded with UploadWizard Functions |