MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [讨论]刚接触matlab,有个小问题 (https://www.labfans.com/bbs/showthread.php?t=2062)

qhbupt 2008-04-04 12:07

[讨论]刚接触matlab,有个小问题
 
我如果想把一个正弦函数离散化的图像画出来应该怎么样呢?

xuf150 2008-04-04 12:54

偶也是刚学MATLAB的,这个还是比较简单实现吧,直接用plot函数就可以,
MATLAB代码:
x=-pi:0.1:pi;
y=sin(x);
plot(x,y,'+')

这个图像就是用离散的'+'表示,当然也可以用其他的颜色或者符号表示.

b blue . point - solid
g green o circle : dotted
r red x x-mark -. dashdot
c cyan + plus -- dashed
m magenta * star (none) no line
y yellow s square
k black d diamond
v triangle (down)
^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram


所有时间均为北京时间。现在的时间是 12:34

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.