第二章:matlab仿真基础

一个简单的例子

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 程序说明:第一个M程序,做简单的数值计算、输出、画图
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 数值计算,语句结束不加分号,可以在命令窗口查看结果
value = sin(pi/4)+cos(1)+log(2)
% 在命令窗口输出文本
disp('Hello World');
% 画一个正弦函数
t = 0:0.5:2*pi;
y = sin(t);
plot(t,y,'-ko','MarkerFace','g')
运行结果图

一、数据类型和数组

MATLAB中共有15种基本的数据类型


matlab中的数据类型

plot()函数中LineSpec可选的字符列表


linespec.png

plot()函数中PropertyName可选的字符列表


propertyname.png

你可能感兴趣的:(第二章:matlab仿真基础)