row = 600; % 相位图在 x 方向的分辨率 column = 600; % 相位图在 y 方向的分辨率 % 初始化相位图 Photo = zeros(row, column); % 设置字母 "M" 的区域为白色 (255) start_col = round(column/6); % M 的起始列索引 end_col = round(column*2/6); % M 的结束列索引 start_row = round(row/2); % M 的起始行索引 end_row = row; % M 的结束行索引 Photo(start_row:end_row, start_col:end_col) = 255; start_col = round(column*3/6); % M 的起始列索引 end_col = round(column*4/6); % M 的结束列索引 start_row = round(row/2); % M 的起始行索引 end_row = row; % M 的结束行索引 Photo(start_row:end_row, start_col:end_col) = 255; start_col = round(column*5/6); % M 的起始列索引 end_col = round(column*6/6); % M 的结束列索引 start_row = round(row/2); % M 的起始行索引 end_row = row; % M 的结束行索引 Photo(start_row:end_row, start_col:end_col) = 255; % 保存图像文件 imwrite(Photo, 'letter_M.tif');