在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1642|回复: 2

MATLAB编程错误求组助

[复制链接]
发表于 2018-12-15 12:04:52 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
有一个串MATLAB代码运行错误说没定义变量或者函数,哪位大佬给我看下错哪儿了?代码如下:
clear;clc;
n=128;
w=20;
u=4;
a=2;
b=0.3;
x(1)=0.32;
y(1)=0.32;
for i=1:n;
    x(i+1)=cos(w*acos(x(i)));
end
for i=1:n
    if x(i)>=0
        x(i)=1;
    else x(i)=-1;
    end
end
for i=1:n
    y(i+1)=u*y(i)*(1-y(i));
end
for i=1:n
    if y(i)>=0.5
        y(i)=1;
    else y(i)=-1;
    end
end
for i=1:n
    z(i+1)=1-a*z(i)^2;
end
for i=1:n
    if z(i)>=0
        z(i)=1;
    else x(i)=-1;
    end
end
for i=1:n
    if (p(i)>0&p(i)<b)
        p(i+1)=(1-P(i))/(1-b);
    end
end
for i=1:n
    if p(i)>=0.5
        p(i)=1;
    else p(i)=-1;
    end
end
subplot (2,2,1);
plot (x,'r');
title ('量化的二值chebyshev序列');
axis ([0 125 -1.5 1.5]);
subplot (2,2,3);
plot (y,'g');
title ('量化的二值logistic序列');
axis ([0 125 -1.5 1.5]);
subplot (2,2,3);
plot (z,'b');
title ('量化的二值改进logistic序列');
axis ([0 125 -1.5 1.5]);
subplot (2,2,4);
plot (p,'y');
title ('量化的二值Tent序列');
axis ([0 125 -1.5 1.5]);
发表于 2018-12-17 10:13:28 | 显示全部楼层
没有细看,但一开始x(1)=0.32;y(1)=0.32;这里就没有定义
发表于 2018-12-17 16:33:16 | 显示全部楼层
回复 1# gl9410
加入p = zeros(n);
      z = zeros(n);
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /3 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-24 06:09 , Processed in 0.017755 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表