% calculate motor speed % input file: time differences between encoder ticks in micro seconds % 2024-06-27 Christoph M. x=csvread("timeBetweenEncoderTicks_us_3p4V_560mA.txt"); if 0 subplot(2,1,1); plot(x); xlabel("n"); ylabel("dt [us]"); ylim([0,10000]); end #subplot(2,1,2); t=cumsum(x)/1e6; encoderTicks=24; measuredFrequency_Hz=1e6./x; rounds_per_sec=measuredFrequency_Hz/encoderTicks RPM=rounds_per_sec*60 plot(t,RPM); title("motor speed supply 3.4V on/off") xlabel("time [s]"); ylabel("RPM"); ylim([0,2000]) grid;