I am having problems to generate a sine-wave Gabor grating. Can someone help please?
2 次查看(过去 30 天)
显示 更早的评论
Hello! I am trying to use a code provided from a book to generate a gabor sine-ave grating stimulus. In this book they suggest we create a function first, called showImage:
%%% Program showImage.m function gca = showImage(M, lut_type) gca = fi gure; % Opens a graphics window image(M); % Display image M in the graphics window axis( ‘ image ’ ); % Sets axis properties of the image in the % graphics window axis( ‘ off ’ ); % Turn off the axes if strcmp(lut_type, ‘ grayscale ’ ) % Check if lut_type is % grayscale lut = [(0:255) ′ (0:255) ′ (0:255) ′ ]/255; colormap(lut); else colormap( ‘ default ’ ); % Use Matlab ’ s default colormap end
The problem is at the fifth last line: lut = [(0:255) ′ (0:255) ′ (0:255) ′ ]/255; the (') symbols seems odd! They appear in 3, not in a even number. Can someone correct this code? Thank you!
0 个评论
回答(2 个)
Bob Blaine
2017-12-15
Hi Caroline,
I'm not sure of the exact problem that you are having, but if you do the following:
surf(peaks)
lut = [(0:255)' (0:255)' (0:255)' ]/255;
colormap(lut);
You get a nice grayscale display of peaks. The ' mark transposes the number list in the parens so you end up with a matrix with 256 rows and 3 columns. I suspect that there's a syntax problem in your code that I can't see.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!