matlab常用函数

1. size() 获取矩阵的行数或列数
s=size(A) , 当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时矩阵的行数,第二个元素是矩阵的列数。
[r,c]=size(A), 当有两个输出参数时, size 函数将矩阵的行数返回到第一个输出变量r,将矩阵的列数返回到第二个输出变量 c
size(A,n)如果在 size 函数的输入参数中再添加一项n,并用1或2为n赋值,则 size 将返回矩阵的行数或列数。其中 r=size(A,1) 该语句返回的时矩阵A的行数, c=size(A,2) 该语句返回的时矩阵 A 的列数。


2.conv2
C=conv2(A,B) 返回 A,B 卷积得到的矩阵

A=rand(5)

A =

0.7733    0.2961    0.6054    0.4071    0.0318
0.7065    0.3604    0.0829    0.6173    0.8172
0.5596    0.4379    0.4743    0.4797    0.3974
0.0013    0.0400    0.3350    0.3974    0.4252
0.9327    0.8844    0.5378    0.8274    0.5774

B=rand(3)

B =

0.6794    0.6296    0.8829
0.1516    0.4597    0.8582
0.0909    0.2504    0.2984

mesh=conv2(A,B,’valid’)

mesh =

2.2366    1.7291    1.7550
1.3160    1.3673    1.7763
2.1357    2.2233    2.2204

mesh=conv2(A,B,’full’)

mesh =

0.5253    0.6880    1.2804    0.9192    0.8124    0.3795    0.0281
0.5972    1.0900    1.7986    1.3840    1.7286    1.4236    0.7488
0.5576    1.2498    2.2366    1.7291    1.7550    1.7086    1.0617
0.1499    0.5613    1.3160    1.3673    1.7763    1.6018    0.9603
0.6847    1.3747    2.1357    2.2233    2.2204    1.8732    0.9932
0.1415    0.5668    1.3294    1.2637    1.1676    1.2006    0.6224
0.0848    0.3140    0.5487    0.4738    0.4202    0.3915    0.1723

mesh=conv2(A,B,’same’)

mesh =

1.0900    1.7986    1.3840    1.7286    1.4236
1.2498    2.2366    1.7291    1.7550    1.7086
0.5613    1.3160    1.3673    1.7763    1.6018
1.3747    2.1357    2.2233    2.2204    1.8732
0.5668    1.3294    1.2637    1.1676    1.2006

‘full’ — Return the full 2-D convolution.
‘same’ — Return the central part of the convolution, which is the same size as A.
‘valid’ — Return only parts of the convolution that are computed without zero-padded edges.


3. J=edgetaper(I,PSF) 使用点扩散函数矩阵 PSF 对输入图像I的边缘进行模糊处理。 PSF 的大小不得超过图像任意维大小的一半.


4.

A=rand(3)

A =

0.9355    0.4629    0.8031
0.3359    0.5980    0.1569
0.8194    0.7714    0.6698

B = padarray(A,[2 2],’replicate’,’both’)

B =

0.9355    0.9355    0.9355    0.4629    0.8031    0.8031    0.8031
0.9355    0.9355    0.9355    0.4629    0.8031    0.8031    0.8031
0.9355    0.9355    0.9355    0.4629    0.8031    0.8031    0.8031
0.3359    0.3359    0.3359    0.5980    0.1569    0.1569    0.1569
0.8194    0.8194    0.8194    0.7714    0.6698    0.6698    0.6698
0.8194    0.8194    0.8194    0.7714    0.6698    0.6698    0.6698
0.8194    0.8194    0.8194    0.7714    0.6698    0.6698    0.6698

‘both’:Pads before the first element and after the last array element along each dimension. This is the default.
‘post’:Pad after the last array element along each dimension.
‘pre’:Pad before the first array element along each dimension.

‘circular’:Pad with circular repetition of elements within the dimension.
‘replicate’:Pad by repeating border elements of array.
‘symmetric’:Pad array with mirror reflections of itself.

添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值