24小时热门版块排行榜    

查看: 540  |  回复: 6

悠悦小牛奶

新虫 (初入文坛)

[交流] 【求助】请高手解答 画图问题 已有3人参与

请问如何实现  用随机的顶点坐标值画出5个黄色三角形
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zjliu1265

至尊木虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖交流
是这个意思不?
close all;clear;clc;
hold on;
rand('state',18);
x=rand(5,3);x=sort(x);x(3,=x(3,+0.3;
y=rand(5,3);y=sort(y);y(3,=y(3,-0.2;
for k=1:5;
    fill(x(k,,y(k,,'y');
end
2楼2010-05-05 14:19:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

悠悦小牛奶

新虫 (初入文坛)

额  我咋运行不出结果呢
3楼2010-05-05 14:44:20
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

悠悦小牛奶

新虫 (初入文坛)

引用回帖:
Originally posted by zjliu1265 at 2010-05-05 14:19:35:
是这个意思不?
close all;clear;clc;
hold on;
rand('state',18);
x=rand(5,3);x=sort(x);x(3,=x(3,+0.3;
y=rand(5,3);y=sort(y);y(3,=y(3,-0.2;
for k=1:5;
    fill(x(k,,y(k,,'y');
end

我咋运行不出结果  出现这个 Attempt to execute SCRIPT fill as a function
4楼2010-05-05 14:45:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

悠悦小牛奶

新虫 (初入文坛)

啊 我知道了 是我的问题 我把文件名整成fill了
5楼2010-05-05 15:11:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

悠悦小牛奶

新虫 (初入文坛)

引用回帖:
Originally posted by zjliu1265 at 2010-05-05 14:19:35:
是这个意思不?
close all;clear;clc;
hold on;
rand('state',18);
x=rand(5,3);x=sort(x);x(3,=x(3,+0.3;
y=rand(5,3);y=sort(y);y(3,=y(3,-0.2;
for k=1:5;
    fill(x(k,,y(k,,'y');
end

谢谢您啦哈 就是这个意思
但是想麻烦您再说明一下那个rand('state',18); 是做什么的丫  我看帮助没看懂 嘿嘿
6楼2010-05-05 15:18:57
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

rewind

至尊木虫 (正式写手)

★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
adu886886(金币+2):谢谢应助 2010-05-05 16:36:17
以下为帮助文件中的说明:

   RAND   Uniformly distributed random numbers.    标准化分布的随机数
    RAND(N) is an N-by-N matrix with random entries, chosen from a uniform distribution on the interval (0.0,1.0).   rand(N)为随机生成一个在【0,1】之间的n维随机矩阵。
    RAND(M,N) and RAND([M,N]) are M-by-N matrices with random entries.随机生成一个在【0,1】之间的m,n维随机矩阵。
    RAND(M,N,P,...) or RAND([M,N,P,...]) generate random arrays.
    RAND with no arguments is a scalar whose value changes each time it  is referenced.  RAND(SIZE(A)) is the same size as A.  

    RAND produces pseudo-random numbers.  The sequence of numbers  generated is determined by the state of the generator.  Since MATLAB  resets the state at start-up, the sequence of numbers generated will  be the same unless the state is changed.  matlab的随机数算法是通过一个“种子”递推出来的, 种子在程序初始的时候都一样。
    S = RAND('state') is a 35-element vector containing the current state  of the uniform generator.  RAND('state',S) resets the state to S.
    RAND('state',0) resets the generator to its initial state. 重新恢复初始状态,刚运行matlab时候的状态
    RAND('state',J), for integer J, resets the generator to its J-th state. 安排种子产生第j个状态
    RAND('state',sum(100*clock)) resets it to a different state each time.根据时间产生不同的随机数
在外种地...
7楼2010-05-05 16:22:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 悠悦小牛奶 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见