1.画正弦波
x=linspace(0,2*pi,100);
y=sin(x);
plot(x,y);
2.画方波
x=linspace(0,4*pi,100);
y=square(x);
plot(x,y);
3.矩阵赋值
4.标准函数
5.画图
title:标题
grid:开关网格线
叠加多条曲线
3.GUI画正弦波
Fs = 44100;
dt = 1.0/Fs;
T = 1;
N = T/dt;
t = linspace(0,T,N);
x = 0.3*sin(2*pi*600*t);
plot(t,x,'r','LineWidth',3);
axis([0,0.01,-0.5,0.5]);
set(gca,'color',[0.95,0.95,0.95]);
sound(x,Fs);
4.GUI生成任意频率
F = str2double(get(handles.edit1,'string'));
Fs = 44100;
dt = 1.0/Fs;
T = 1;
N = T/dt;
t = linspace(0,T,N);
x = 0.3*sin(2*pi*F*t);
plot(t,x,'r','LineWidth',3);
axis([0,0.01,-0.5,0.5]);
set(gca,'color',[0.95,0.95,0.95]);
sound(x,Fs);