Matlab 版 (精华区)

发信人: zjliu (秋天的萝卜), 信区: Matlab
标  题: [合集]请教一个画图问题
发信站: 哈工大紫丁香 (2003年10月31日15:01:00 星期五), 站内信件


────────────────────────────────────────
 martianwang (活着)                   于 2003年10月25日08:27:30 星期六 说道:

theta=0:0.1:2*pi;
for i=1:4
    a(i)=input('a=');b(i)=input('b=');n(i)=input('n=');
    rho(i,:)=a(i)*cos(b(i)+n(i)*theta);
    subplot(2,2,i),polar(theta,rho(i,:));title('a=a(i),b=b(i),n=n(i)')
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~怎么改?
end
画图,我想在每个图的标题位置,能显示出a,b,c的值
该怎么办?
3ks

────────────────────────────────────────
 zjliu (秋天的萝卜)                   于 2003年10月25日08:57:36 星期六 说道:

修改如下:
theta=0:0.1:2*pi;
for i=1:4
    a(i)=input('a=');b(i)=input('b=');n(i)=input('n=');
    rho(i,:)=a(i)*cos(b(i)+n(i)*theta);
    subplot(2,2,i),
    polar(theta,rho(i,:));
    c=['a=' num2str(a(i))];
    title(c)
end

────────────────────────────────────────
 ambotao (ambo )                      于 Sat Oct 25 09:00:09 2003 说道:


你想改什么,想让他成为a(1),a(2)……的显示吗?建议查阅国防工业出版社的《matlab6
.1基础及应用技巧》李海涛

────────────────────────────────────────
 martianwang (活着)                   于 2003年10月25日12:59:20 星期六 说道:

多谢斑竹
还有一个问题:程序执行完之后,我想在图形窗最上边中间位置中标上一句话,
并且程序执行时,自动加上,
该怎么做呢?
谢谢。
修改如下:
theta=0:0.1:2*pi;
for i=1:4
    a(i)=input('a=');b(i)=input('b=');n(i)=input('n=');
    rho(i,:)=a(i)*cos(b(i)+n(i)*theta);
    subplot(2,2,i),
    polar(theta,rho(i,:));
    c=['a=' num2str(a(i))];
    title(c)
end

────────────────────────────────────────
 zjliu (秋天的萝卜)                   于 2003年10月25日14:37:28 星期六 说道:

完整程序如下:
theta=0:0.1:2*pi;
for i=1:4
    a(i)=input('a=');b(i)=input('b=');n(i)=input('n=');
    rho(i,:)=a(i)*cos(b(i)+n(i)*theta);
    subplot(2,2,i),
    polar(theta,rho(i,:));
    c=['a=' num2str(a(i))];
    title(c)
end
H=xlabel('martianwang','Position',[1.8722 1.52535 1.00011])

────────────────────────────────────────
 martianwang (活着)                   于 2003年10月25日23:15:51 星期六 说道:

这个根本就不行
标题要在四个图的正上方

────────────────────────────────────────
 zjliu (秋天的萝卜)                   于 2003年10月26日08:50:50 星期天 说道:

你把这个语句中的参数改一下,就可以了,我看着是正上方了
H=xlabel('martianwang','Position',[1.8722 1.52535 1.00011])

────────────────────────────────────────
 martianwang (活着)                   于 2003年10月26日09:01:24 星期天 说道:

能解释一下是什么意思吗?
为什么要附值给H?
你把这个语句中的参数改一下,就可以了,我看着是正上方了
H=xlabel('martianwang','Position',[1.8722 1.52535 1.00011])

────────────────────────────────────────
 zjliu (秋天的萝卜)                   于 2003年10月26日09:05:15 星期天 说道:

H是句柄,不写它也可以的,
用get(H)可以得到xlabel函数的很多参数

────────────────────────────────────────
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.949毫秒