| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- xdel(winsid())
- clear;
- t = [0:0.01:10];
- a = 1;
- b = 7;
- k = 1;
- magnitude = 100;
- offset = 40;
- 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 + offset;
- t = [1:length(ylong)];
- // Plot vertical lines
- xpts = [1 1];
- ypts = [-0.2*magnitude 0]+offset;
- plot(xpts*1000, ypts, '-');
- plot(xpts*5000, ypts, '-');
- plot(xpts*8000, ypts, '-');
- ypts = [-0.1*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), 0; max(t),1.05*(magnitude+offset)];
- a.box = "off";
- f=get("current_figure")
- f.figure_size=f.figure_size*1.3 // Råkade bli lagom storlek
|