I am having problems to generate a sine-wave Gabor grating. Can someone help please?

1 visualización (últimos 30 días)
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!

Respuestas (2)

Bob Blaine
Bob Blaine el 15 de Dic. de 2017
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.

Caroline Alencar
Caroline Alencar el 18 de Dic. de 2017
I replaced my "lut" line for yours and it worked! Thank you!

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by