-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfitResponse.m
More file actions
33 lines (29 loc) · 851 Bytes
/
fitResponse.m
File metadata and controls
33 lines (29 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [fitPars, fitErr, fittedResp] = fitResponse(deg, singleResp, cardinalDir, initPars)
%[fitPars, fitErr, fittedResp] = fitResponse(singleResp, sortedLabels, cardinalDir, initPars)
%
% INPUTS:
% deg: stimulus angle in degree
%
% OUTPUTS:
% [Dp(peak angle), Rp(peak amp), Rn(2nd peak amp = 0), Ro(baseline), sigma(width)]
%
%
%created from resp_cueConditions
%fitoriWrapped from Matteobox
if nargin < 4
initPars = [];
end
avgResp = [];
for idir = 1:numel(cardinalDir)
avgResp(idir) = mean(singleResp(deg == cardinalDir(idir)));
end
minResp = min(avgResp);
[fitPars, fitErr] ...
= fitoriWrapped(deg, singleResp,...
[], [nan nan 0 minResp nan],'',20, initPars);
if nargout > 2
fittedResp ...
= orituneWrapped(fitPars, cardinalDir);
%plot(cardinalDir, avgResp);hold on
%plot(cardinalDir, fittedResp)
end