无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

北太天元畫矩陣非零元的腳本

2023-06-11 22:38 作者:盧朓  | 我要投稿

%draw_matrix.m 北太天元腳本函數(shù)

% 北太天元把矩陣中的非零元的位置畫出來

% A [input] 布爾矩陣或者double 矩陣,如果|A(i,j)| > eps 則填充紅色

%??非零元使用 |A(i,j)|>eps 來判定的

%例如

%clf

%close all

%clear all


%m = 3;

%n = 3;

%A = zeros(m,n);


%A(2,2) = 1.0;

%draw_matrix(A)


%

function??ok = draw_matrix(A)

???clf

???close all

???hold on;


???if isa(A,'double')

??????B?= abs(A) > eps;

???elseif islogical(A)

??????B = A

???else

??????ok = false;

??????error("A需要是布爾矩陣或者double矩陣");

???end


???[m,n] = size(A);


???for i=1:m

??????for j=1:n

?????????if(B(i,j))??????

????????????tiao_rectangle('Position',[i-1 j-1 1 1], 'Curvature', 0, 'FaceColor', [1,0,0], 'EdgeColor','m', 'LineWidth', 1)

?????????else


????????????tiao_rectangle('Position',[i-1 j-1 1 1], 'Curvature', 0, 'FaceColor', [0.9,0.9,0.9], 'EdgeColor','m', 'LineWidth', 1)

?????????end

??????end

???end

???hold off

???ok = true;

end


%Position[input]??總是寫成"Position"

%pos[input] 是一個1x4的矩陣 pos =[ 左下x, 左下y, 寬度, 高度]

%cur[input]?0 表示直角舉行

%fc[input]?填充的顏色

%lw[input] 邊的寬度

function ok = tiao_rectangle(Position, pos, Curvature, curv, FaceColor, fc, EdgeColor, ec, LineWidth, lw)

?len = length(curv);

?if (len >= 2)

???horz_curv = curv(1);

???vert_curv = curv(2);

?elseif (len == 1)

???horz_curv = curv(1);

???vert_curv = curv(1);

?else

???horz_curv = 0;

???vert_curv = 0;

?end


?lux = pos(1); luy =pos(2);

?width = pos(3); height = pos(4);



?if ( abs(horz_curv)<0.1 && abs(vert_curv) <0.1 )

???fx = [lux, lux+width, lux+width ,lux];

???fy = [luy, luy, luy+height, luy+height];

?else

???n = 15;

???p = pi / 2 * [0 : n] / n;

???c = curv .* pos(3:4) / 2;

???cx = c(1) * sin (p) - c(1);

???cy = c(2) * cos (p) - c(2);

???fx = [pos(1) - cx(n+1:-1:1), pos(1) + pos(3) + cx, ...

?????pos(1) + pos(3) + cx(n+1:-1:1), pos(1) - cx, pos(1)];

???fy = [pos(2) - cy(n+1:-1:1), pos(2) - cy, ...

?????pos(2) + pos(4) + cy(n+1:-1:1), ...

?????pos(2) + pos(4) + cy, pos(2) + c(2)];

?end


?fill(fx, fy, fc, EdgeColor, ec, LineWidth, lw)

?ok = true;

end



北太天元畫矩陣非零元的腳本的評論 (共 條)

分享到微博請遵守國家法律
苏州市| 普兰县| 石家庄市| 大渡口区| 通化市| 县级市| 邓州市| 额尔古纳市| 阜城县| 佛学| 南华县| 新昌县| 溧阳市| 定陶县| 绥滨县| 宜昌市| 涿州市| 莲花县| 延津县| 祥云县| 延吉市| 常山县| 特克斯县| 南部县| 大厂| 沙河市| 鄱阳县| 华蓥市| 金堂县| 宁乡县| 屯门区| 陈巴尔虎旗| 三明市| 防城港市| 铜陵市| 朔州市| 阿坝| 金阳县| 定西市| 子洲县| 侯马市|