[READ-ONLY] Mirror of https://github.com/jmrplens/MATLAB_Instruments. Laboratory instruments control with MATLAB
experiment instruments laboratory matlab
0

Configure Feed

Select the types of activity you want to include in your feed.

Update

Jose M. Requena Plens (Nov 5, 2021, 10:44 AM +0100) 2048f2ac 7b95d8de

+69 -10
+15 -8
TiePie Handyscope HS5/Example_TiePie_GenRec_Arbitrary.m
··· 4 4 %% Parameters 5 5 6 6 % Signal parameters 7 - fs = 1e6; % Sample rate (Hz) 8 - f1 = 37e3; % Hz 9 - f2 = 43e3; % Hz 10 - T = 0.02; % s 7 + fs = 2e6; % Sample rate (Hz) 8 + f1 = 5e3; % Hz 9 + f2 = 500e3; % Hz 10 + T = 0.2; % s 11 + phase0 = true; 11 12 % Amplitude 12 - Amp = 2; % Volts pp 13 + Amp = 8; % Volts pp 13 14 % Repetitions 14 15 Pulses = 1; 15 16 16 17 % Acquisition parameters 17 - RecordLength = ceil((T+5e-3)*fs); % Samples 18 + RecordLength = ceil((T*Pulses+20e-3)*fs); % Samples 18 19 VRange = [Amp,0.1*Amp]; % Volts 19 20 ProbeGain = [1,3]; 20 21 Channels = [1,2]; ··· 27 28 28 29 %% Signal generation 29 30 import Others.* 30 - [data,~] = SweptSine(f1,f2,fs,T); 31 + [data,~] = Sync_SweptSine(f1,f2,fs,T,phase0); 31 32 32 33 %% Generation and reception 33 34 [signal,t,real_fs] = TiePie_GENandREC_Arbitrary(LIB,data,fs,Channels,Amp,Pulses,RecordLength,VRange,ProbeGain); ··· 37 38 dataCH2 = signal(:,2); 38 39 39 40 % Plot 41 + figure('Color',[1,1,1]) 40 42 yyaxis left 41 43 plot(t,dataCH1); 42 44 ylim([-VRange(1),VRange(1)]) ··· 47 49 ylim([-VRange(2),VRange(2)]) 48 50 legend('Channel 1','Channel 2') 49 51 xlabel('Time [s]'); 50 - ylabel('Amplitude channel 2 [V]'); 52 + ylabel('Amplitude channel 2 [V]'); 53 + 54 + %% Deconv 55 + Sync_SweptSine_Deconv(dataCH1,f1,f2,fs,T,phase0,3,1); 56 + 57 + Sync_SweptSine_Deconv(dataCH2,f1,f2,fs,T,phase0,3,1);
+45
TiePie Handyscope HS5/Example_TiePie_GenRec_Sine.m
··· 1 + % Test TiePie 2 + clc, close all; 3 + 4 + %% Parameters 5 + 6 + % Signal parameters 7 + fs = 1e6; % Sample rate (Hz) 8 + f = 80e3; % Hz 9 + % Amplitude 10 + Amp = 8; % Volts pp 11 + % Repetitions 12 + Pulses = 50; 13 + 14 + % Acquisition parameters 15 + RecordLength = ceil((1/f*Pulses+0.1e-3)*fs); % Samples 16 + VRange = [Amp,0.1*Amp]; % Volts 17 + ProbeGain = [1,3]; 18 + Channels = [1,2]; 19 + 20 + %% Import Assets 21 + addpath('TiePieLib') 22 + % Get library 23 + import LibTiePie.* 24 + LIB = get_TiePie_Library(); 25 + 26 + %% Generation and reception 27 + [signal,t,real_fs] = TiePie_GENandREC_Sine(LIB,f,fs,Channels,Amp,Pulses,RecordLength,VRange,ProbeGain); 28 + 29 + % Data 30 + dataCH1 = signal(:,1); 31 + dataCH2 = signal(:,2); 32 + 33 + % Plot 34 + figure('Color',[1,1,1]) 35 + yyaxis left 36 + plot(t,dataCH1); 37 + ylim([-VRange(1),VRange(1)]) 38 + xlabel('Time [s]'); 39 + ylabel('Amplitude channel 1 [V]'); 40 + yyaxis right 41 + plot(t,dataCH2); 42 + ylim([-VRange(2),VRange(2)]) 43 + legend('Channel 1','Channel 2') 44 + xlabel('Time [s]'); 45 + ylabel('Amplitude channel 2 [V]');
+9 -2
TiePie Handyscope HS5/TiePieLib/+Others/Sync_SweptSine_Deconv.m
··· 1 1 function [FR,f,IR,t,HHFR,fHH,HHIR,tHH] = Sync_SweptSine_Deconv(signal_rec,f1,f2,fs,T,phase0,N,show) 2 2 % 3 + % [FR,f,IR,t,HHFR,fHH,HHIR,tHH] = Sync_SweptSine_Deconv(signal_rec,f1,f2,fs,T,phase0,N,show) 3 4 % 4 5 % [1] Antonin Novak, Laurent Simon, Pierrick Lotton. Synchronized 5 6 % Swept-Sine: Theory, Application, and Implementation. Journal of the ··· 41 42 N (1,1) {mustBeScalarOrEmpty,mustBeInteger,mustBePositive} = 3 42 43 show {mustBeScalarOrEmpty,mustBeMember(show,[0,1])} = false 43 44 end 44 - close all 45 + 45 46 % Rate frequency increase 46 47 if phase0 == true 47 48 L = (1/f1)*round((f1/log(f2/f1))*T); % Initial phase at 0 ··· 88 89 dt_rem = dt - dt_; 89 90 90 91 % circular periodisation of IR 91 - len_IR = 2^14; 92 + len_IR = 2^15;%length(IR); 92 93 pre_IR = round(len_IR / 2); 93 94 h_pos = [IR; IR(1:len_IR)]; 94 95 ··· 100 101 101 102 st0 = length(h_pos); 102 103 for n = 1:N 104 + 103 105 % start position of n-th IR 104 106 st = length(IR) - dt_(n) - pre_IR; 107 + if st<0 108 + N = n; 109 + break; 110 + end 111 + 105 112 % end position of n-th IR 106 113 ed = min(st + len_IR, st0); 107 114