1.2 matlab信号分析编程基础

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.标准函数
1.2 matlab信号分析编程基础_第1张图片
5.画图
1.2 matlab信号分析编程基础_第2张图片
1.2 matlab信号分析编程基础_第3张图片
title:标题
grid:开关网格线
1.2 matlab信号分析编程基础_第4张图片
叠加多条曲线
1.2 matlab信号分析编程基础_第5张图片
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);

你可能感兴趣的:(matlab,开发语言)