24小时热门版块排行榜    

查看: 193  |  回复: 1

amethyst356

木虫 (小有名气)

[求助] 这段code应该怎么修改?

clc;
clrear;

x = [0:0.1:1]

for j = 1:length(x)

         y(j) = (j-1)*10;

        m11(j) = cos(y(j));
        m12(j) = -sin(y(j));
        m21(j) = sin(y(j));
        m22(j) = cos(y(j));

       M(j) = [m11(j) m12(j);m21(j) m22(j)];

       n11(j) = -cos(y(j));
       n12(j) = sin(y(j));
       n21(j) = sin(y(j));
       n22(j) = -cos(y(j));

       N(j) = [n11(j) n12(j);n21(j) n22(j)];

       MN(j) = M(j).*N(j);

       P(j) = (MN(j)).^8

       p11(j) = (P(j))(1,1);
       p12(j) = (P(j))(1,2);
       p21(j) = (P(j))(2,1);
       p22(j) = (P(j))(2,2);

      R(j) = (p11(j)+p22(j))/(p21(j)+p22(j));
end

plot(y,R)

???  In an assignment  A(I) = B, the number of elements in B and
I must be the same.

Error in ==> RT at 41
M(j) = [m11(j) m12(j);m21(j) m22(j)];

请问上面的code怎么修改,谢谢!
回复此楼

» 猜你喜欢

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

弱水三千,我一瓢一瓢饮。。。
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★
xiegangmai(金币+2): 谢谢应助! 2011-11-17 23:14:31
amethyst356(金币+50): 2011-11-18 07:40:12
CODE:
clc;
clear;

x = [0:0.1:1]

for j = 1:length(x)

         y(j) = (j-1)*10;

        m11(j) = cos(y(j));
        m12(j) = -sin(y(j));
        m21(j) = sin(y(j));
        m22(j) = cos(y(j));

       M = [m11(j) m12(j);m21(j) m22(j)];

       n11(j) = -cos(y(j));
       n12(j) = sin(y(j));
       n21(j) = sin(y(j));
       n22(j) = -cos(y(j));

       N = [n11(j) n12(j);n21(j) n22(j)];

       MN= M.*N;

       P= MN.^8

       p11(j) = P(1,1);
       p12(j) = P(1,2);
       p21(j) = P(2,1);
       p22(j) = P(2,2);

      R(j) = (p11(j)+p22(j))/(p21(j)+p22(j));
end

plot(y,R)

The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-11-17 19:31:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 amethyst356 的主题更新
信息提示
请填处理意见