Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jesse Heckman
pbtoolbox
Commits
6afa7dba
Commit
6afa7dba
authored
Nov 08, 2018
by
Jesse Heckman
Browse files
added predict sine to vPrime
parent
295044a1
Changes
5
Hide whitespace changes
Inline
Side-by-side
setups/vestibular chair/vPrime/core/experiment/block/pb_vCreateSignal.m
View file @
6afa7dba
...
...
@@ -60,22 +60,18 @@ function [x,t] = VC_sinesignal(dur, SR, freq)
t
=
0
:
1
/
SR
:
dur
;
x
=
sin
(
w
*
t
);
L
=
length
(
t
);
x
=
x
.*
tukeywin
(
L
,
0.25
)
'
;
tsz
=
length
(
t
);
x
=
x
.*
tukeywin
(
tsz
,
0.25
)
'
;
end
function
[
x
,
t
]
=
VC_predictedsine
(
dur
,
SR
,
freq
)
%%% <--- TO DO: FIX THE TRANSFER FUNCTION!!
% function generates a perfect sine output
a
=
1.39
;
b
=
1.4
;
w
=
freq
*
2
*
pi
;
t
=
0
:
1
/
SR
:
dur
;
x
=
(
b
*
sin
(
w
*
t
)
+
w
*
cos
(
w
*
t
))/
a
;
x
fun
=
pb_y2x
()
;
L
=
length
(
t
);
x
=
x
.*
tukeywin
(
L
,
0.25
)
'
;
tsz
=
length
(
t
);
x
=
x
fun
(
1
,
freq
,
t
)
.*
tukeywin
(
tsz
,
0.25
)
'
;
end
function
[
x
,
t
]
=
VC_turnsignal
(
dur
,
SR
)
...
...
@@ -85,6 +81,7 @@ function [x,t] = VC_turnsignal(dur, SR)
v
=
randn
(
1
,
1
);
x
=
v
*
t
;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
...
...
setups/vestibular chair/vPrime/core/experiment/block/pb_vSignalVC.m
View file @
6afa7dba
...
...
@@ -15,6 +15,10 @@ function [Dat,profile,dur] = pb_vSignalVC(handles)
signal
(
1
)
=
block
(
bnumber
)
.
signal
.
ver
;
signal
(
2
)
=
block
(
bnumber
)
.
signal
.
hor
;
signal
=
pb_vSafety
(
signal
);
for
iSig
=
1
:
2
if
strcmp
(
signal
(
iSig
)
.
type
,
'sine'
);
signal
(
iSig
)
.
type
=
'predictsine'
;
end
end
%% CREATE BASIC SIGNAL
vSignal
=
pb_vCreateSignal
(
1
,
signal
(
1
)
.
duration
,
10
,
signal
(
1
)
.
frequency
,
signal
(
1
)
.
type
);
...
...
setups/vestibular chair/vPrime/core/pb_vRunExp.m
View file @
6afa7dba
...
...
@@ -61,7 +61,7 @@ function pb_vRunExp(handles)
for
iTrl
=
1
:
nTrials
% Runs all trials within one block
% setup trial
updateTrial
(
handles
);
stim
=
handles
.
block
(
iBlck
)
.
trial
(
iTrl
)
.
stim
;
...
...
tmp/double_sac.exp
View file @
6afa7dba
...
...
@@ -11,8 +11,8 @@ Random 0 % 0=no, 1=per set, 2=all trials
Motor n
Lab 5
% AX SIG AMP DUR
%
edg bit Event Time Event Time
% AX SIG AMP DUR
FREQ
%
% MOD X Y ID INT On On Off Off Event
% edg bit Event Time Event Time
...
...
setups/vestibular chair/vAnalyse
/pb_y2x.m
→
utilities/math
/pb_y2x.m
View file @
6afa7dba
function
x
=
pb_y2x
(
y
,
H
)
% PB_Y2X(
y, H
)
function
x
=
pb_y2x
(
varargin
)
% PB_Y2X(
varargin
)
%
% PB_Y2X(
) transforms the symbolic wanted output expression to a symbolic
%
required input expression, using Laplace transformation and the system's
%
transfer function
.
% PB_Y2X(
varargin) returns a matlabFunction to achieve a wanted vestibular
%
output. Note that if no input arguments are provided. Transfer function
%
and wanted output are chosen by default parameters
.
%
% See also PB_
ITF
% See also PB_
VCREATESIGNALS, MATLABFUNCTION
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
syms
s
t
x
X
Y
syms
x
y
h
X
H
Y
s
t
w
a
f
if
nargin
==
1
% if no tf was provided select default parameters (tf2 for VC model dat with ampl. 15).
syms
H
s
N
D
N
(
s
)
=
2.002
*
s
+
0.01492
;
D
(
s
)
=
s
^
2
+
2.009
*
s
+
0.0145
;
H
(
s
)
=
N
/
D
;
end
Y
(
s
)
=
laplace
(
y
);
X
(
s
)
=
Y
(
s
)/
H
(
s
);
def
=
loaddefaults
;
H
=
pb_keyval
(
'H'
,
varargin
,
def
.
H
);
y
=
pb_keyval
(
'y'
,
varargin
,
def
.
y
);
Y
=
laplace
(
y
);
X
=
Y
/
H
;
x
=
ilaplace
(
X
);
x
=
matlabFunction
(
x
);
end
x
=
ilaplace
(
X
(
s
));
function
def
=
loaddefaults
% Default functions for keyval
syms
x
y
h
X
H
Y
s
t
w
a
f
w
=
f
*
2
*
pi
;
def
.
H
=
(
2
*
s
+
0.015
)/(
s
^
2
+
2
*
s
+
0.015
);
% default transfer function VC
def
.
y
=
a
*
sin
(
w
*
t
);
% default output VC (sine)
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment