%% Sezione per l'acquisizione s=daq.createSession('ni'); Fs=250; Tw=5; s.Rate=Fs; s.DurationInSeconds=Tw; ch=addAnalogInputChannel(s,'myDAQ1','ai0','Voltage'); data=startForeground(s); % vettore in cui sono i dati che verranno poi generati N_samples=round(Fs*Tw); t=[0:N_samples-1]*(1/s.Rate); figure(1) plot(t,data) xlabel('Time (s)'); ylabel('Voltage (V)'); %% esempio filtraggio Bp=20; Bo=60; A=100; R=0.05; Wp=Bp/(Fs/2); Ws=Bo/(Fs/2); Rs=20*(log(A)); R1=20*log(1+R); R2=20*log(1-R); Rp=(R1-R2)/2; [n Wn]=buttord(Wp,Ws,Rp,Rs); [b, a]=butter(n,Wn, "low"); y=filter(b,a,data); figure (2) plot(t,y) xlabel('Time (s)'); ylabel('Voltage (V)');