数据可视化与分析:MatLab 应用及概率基础
1. MatLab 图形绘制
MatLab 图形功能强大,但要充分利用这些功能,需要学习大量看似令人困惑的函数。下面通过一些示例来进一步了解。
1.1 绘制正弦波数据
首先创建示例数据 d1 和 d2 ,并将其绘制成图形。以下是相应的 MatLab 代码:
% create sample data, d1 and d2
N = 51;
Dt = 1.0;
t = [0:N-1]';
tmax = t(N);
d1 = sin(pi*t/tmax);
d2 = sin(2*pi*t/tmax);
% plot the sample data
figure(7);
clf;
set(gca,'LineWidth',2);
hold on;
axis xy;
axis([0, tmax, -1.1, 1.1]);
plot(t,d1,'k-','LineWidth',2);
plot(t,d2,'k:','LineWidth',2);
title('data consisting of sine waves');
xlabel('time');
ylabel('data');
这段代码的执行步骤如下:
1. 创建时间变量 t 和两个数据变量 d1 、 d2 ,它们分别是正弦波 sin(πt/L) 和 sin(2πt
超级会员免费看
订阅专栏 解锁全文
4383

被折叠的 条评论
为什么被折叠?



