声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

声振论坛 展示 基础理论 查看内容

PlotAxisAtOrigin

2011-3-6 23:26| 发布者: FtpAdmin| 查看: 1167| 评论: 0|来自: 振动论坛

摘要: 来自:http://blogs.mathworks.com As an application engineer I showed MATLAB to a lot of people. Occasionally when I presented graphics capabilities someone would ask how to make plots where the X and ...
来自:http://blogs.mathworks.com
As an application engineer I showed MATLAB to a lot of people. Occasionally when I presented graphics capabilities someone would ask how to make plots where the X and Y axes lines go through the origin. You know: the way we learned to draw them in school. By default MATLAB puts the X axes on bottom and the Y axes on the left.
  1. x = -2*pi:pi/10:2*pi;
  2. y = sin(x);
  3. plot(x,y)
复制代码

While the xAxisLocation can be set to top, and the yAxisLocation can be right, neither has an origin option for example. So, instead, I usually suggested drawing lines through the origin. In fact, prior "Pick of the Week" star Brandon Kuczenski made that trivial with hline and vline.
  1. hline(0)
  2. vline(0)
复制代码

Not satisfied? Neither was Shanrong. Hence, PlotAxisAtOrigin.
  1. PlotAxisAtOrigin(x,y)
复制代码


代码:[attach]40403[/attach]
[attach]40404[/attach]
[attach]40405[/attach]

本文内容由 16443 提供

最新评论

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-24 18:51 , Processed in 0.033884 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部