~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychOneliners/MakeSineImage.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function [image] = MakeSineImage(freqi,freqj,nRowPixels,nColPixels)
 
 
b'% [image] = MakeSineImage(freqi,freqj,nRowPixels,[nColPixels])'
 
 
b'%'
 
 
b'% Computes a two-dimensional sine function image.'
 
 
b'%'
 
 
b'% The image has dimensions nRowPixels by nColPixels.'
 
 
b'% If nColPixels is omitted, a square image is returned.'
 
 
b'%'
 
 
b'% 8/15/94\t\tdhb\t\tBoth row and column dimensions used if passed.'
 
 
b'%\t\t\t\tdhb\t\tChanged zero frequency convention.'
 
 
b'% 6/20/98       dhb, mw Fixed error in zero handling case.'
 
 
b"% Set column pixels for square image if it wasn't passed."
 
 
b'if (nargin <= 3)'
 
 
b'\tnColPixels = nRowPixels;'
 
 
b'end'
 
 
b'x = 1:nColPixels;'
 
 
b'y = 1:nRowPixels;'
 
 
b'usefreqi = 2*pi*freqi/nRowPixels;'
 
 
b'usefreqj = 2*pi*freqj/nColPixels;'
 
 
b'% Handle zero frequency case'
 
 
b'if (usefreqj == 0 & usefreqi ~= 0)'
 
 
b'\tsinx = ones(size(x));'
 
 
b'else'
 
 
b'\tsinx = sin(usefreqj*x);'
 
 
b'end'
 
 
b'% Handle zero frequency case'
 
 
b'if (usefreqi == 0 & usefreqj ~= 0)'
 
 
b'\tsiny = ones(size(y));'
 
 
b'else'
 
 
b'\tsiny = sin(usefreqi*y);'
 
 
b'end'
 
 
b'% Build composite image'
 
 
b"image = siny'*sinx;"
 
 
b'\\ No newline at end of file'
 
1
function [image] = MakeSineImage(freqi,freqj,nRowPixels,nColPixels)
 
2
% [image] = MakeSineImage(freqi,freqj,nRowPixels,[nColPixels])
 
3
%
 
4
% Computes a two-dimensional sine function image.
 
5
%
 
6
% The image has dimensions nRowPixels by nColPixels.
 
7
% If nColPixels is omitted, a square image is returned.
 
8
%
 
9
% 8/15/94               dhb             Both row and column dimensions used if passed.
 
10
%                               dhb             Changed zero frequency convention.
 
11
% 6/20/98       dhb, mw Fixed error in zero handling case.
 
12
 
 
13
% Set column pixels for square image if it wasn't passed.
 
14
if (nargin <= 3)
 
15
        nColPixels = nRowPixels;
 
16
end
 
17
 
 
18
x = 1:nColPixels;
 
19
y = 1:nRowPixels;
 
20
usefreqi = 2*pi*freqi/nRowPixels;
 
21
usefreqj = 2*pi*freqj/nColPixels;
 
22
 
 
23
% Handle zero frequency case
 
24
if (usefreqj == 0 && usefreqi ~= 0)
 
25
        sinx = ones(size(x));
 
26
else
 
27
        sinx = sin(usefreqj*x);
 
28
end
 
29
 
 
30
% Handle zero frequency case
 
31
if (usefreqi == 0 && usefreqj ~= 0)
 
32
        siny = ones(size(y));
 
33
else
 
34
        siny = sin(usefreqi*y);
 
35
end
 
36
 
 
37
% Build composite image
 
38
image = siny'*sinx;