xdel(winsid()) clear; t = [0:0.01:10]; a = 1; b = 7; k = 1; magnitude = 100; offset = 20; y = k*(exp(-a*t) - exp(-b*t) ); // Normalisera till 1 och multiplicera med magnituden y = y/max(y)*magnitude; ymax = max(y)*ones(1,length(y)); // Create repetetive puses ylong=[]; t=[]; for i = [1:13] if(modulo(i, 7) == 0 || modulo(i, 7) == 1) // Skip two pulses ylong = [ylong zeros(1,length(y))]; else // The rest are pulses ylong = [ylong y]; end end // Add offset voltage and create t axis that fits all pulses ylong = ylong*-1; ylong = ylong + offset; t = [1:length(ylong)]; // Plot vertical lines xpts = [1 1]; ypts = [0.3*magnitude 0]+offset; plot(xpts*1000, ypts, '-'); plot(xpts*5000, ypts, '-'); plot(xpts*8000, ypts, '-'); ypts = [0.15*magnitude 0]+offset; plot(xpts*2000, ypts, '-'); //plot(xpts*8.96, ypts, '--'); // Plot horizontal lines plot(ones(1,length(ylong))*min(ylong), '--blue'); // min plot(ones(1,length(ylong))*max(ylong), '--blue'); // Max plot(ones(1,length(ylong))*0, '-black'); // Zero plot(t,ylong, 'black'); // Självaste pulsen p = get("hdl"); p = p.children; p.thickness = 3; // titletxt = ['$y = k(e^{-\alpha t} - e^{-\beta t})$' ; strcat(['$k=', string(k), ', \alpha=', string(a), ', \beta=', string(b), '$']) ]; titletxt = '$y = k(e^{-\alpha t} - e^{-\beta t})$'; //title("Consecutive pulses", 'fontsize', 8); //xlabel('t (s)', 'fontsize', 7); //ylabel('U (V)', 'fontsize', 7, 'rotation', 0); a = get("current_axes"); a.axes_visible(1) = "off"; // Turn off X-axxis a.data_bounds = [min(t), -magnitude; max(t),offset*3]; a.box = "off"; f=get("current_figure") f.figure_size=f.figure_size*1.3 // Råkade bli lagom storlek