MATLAB

MATLAB学习

>> clear
>> clear all
>> load chirp
>> Fs

Fs =

        8192

>> plot(y)
>> figure
>> plot(y)
>> Y=fft(y)
>> plot(abs(Y))
>>> specgram(y)

specgram函数结果
在这里插入图片描述中国锣

>> load gong 
>> sound(y,Fs)
>>> hndlgraf

在微型窗口中

 x = 0:0.02:1;           
 hndl = plot(x,humps(x));
 set(hndl,'Color','red') 
set(hndl,'Marker','x')   
set(hndl,'LineWidth',2)  
set(hndl,'Color','red')  
>> hndlaxis

微型窗口中

 x = logspace(-2,0,500);                  
 plot(x,((sin(1./x)).^2)./x);             
 set(gca,'XGrid','on','YGrid','on');      
set(gca,'XScale','log','YScale','linear');

xpbombs小游戏

>>sound(mtlb*0.01,Fs)
>> sound(mtlb,Fs)
>> sound(mtlb*0.5,Fs)

可通过乘以数来改变音量

编程基础

2.1变量

对复数的处理

real
imag
angle
abs

复数的极坐标输入

z3=25*exp(i*pi*3)

对矩阵的处理

>> f1=[1,2,3]

f1 =

     1     2     3

>> f2=[f1 f1 f1]

f2 =

     1     2     3     1     2     3     1     2     3

>> f3=[f1;f1;f1]

f3 =

     1     2     3
     1     2     3
     1     2     3

>> f4=[f3 f3';f3 fliplr(f3)]

f4 =

     1     2     3     1     1     1
     1     2     3     2     2     2
     1     2     3     3     3     3
     1     2     3     3     2     1
     1     2     3     3     2     1
     1     2     3     3     2     1
>> noise=rand(1,10000);
>> sum(noise)/length(noise)
ans =

    0.4994
>> plot(noise(1:100))
>> hist(noise)
>> noise=randn(1,10000);
>> hist(noise)
>> hist(noise,100)
>> eye(5)
>> linspace(0,1,11)
>> logspace(0,1,10)
>> stem(ans)

矩阵的运算

1.'  \\矩阵转置
2.fliplr(a) 左右翻转
3.flipud(a) 上下翻转
4.rot90(a) 逆时针905.diag(a) 取对角线
6.tril(a) 上三角
7.reshape(a,1,9) 矩阵变维度
exp
exp(1:5)
sqrt
pow2(3)幂函数
nextpow2
log log10 log2

isreal函数 判断是否实数

t=0:0.001:7
x=2*atan(tan(t));
plot(t,x,'b')
hold on
phase=unwrap(x)
plot(t,phase,'r:')
round四舍五入
fix
floor
ceil 向上取整
sign(0.1)符号函数
rem除后的余数
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值