早教吧 育儿知识 作业答案 考试题库 百科 知识分享

Matlab报错为Attemptedtoaccessf(64.4);indexmustbeapositiveintegerorlogical.编码如下:forx=11,11;190;64.4;37.25;110;11;8.3;9.1;41.5;y=f(x);ifx=110f(x)=0;endenddisp(y)

题目详情
Matlab 报错为Attempted to access f(64.4); index must be a positive integer or logical.
编码如下:
for x=11,11;190;64.4;37.25;110;11;8.3;9.1;41.5;
y=f(x);
if x=110
f(x)=0;
end
end
disp(y)
▼优质解答
答案和解析
你的脚本里f是一个数组,把f定义成一个带参数的函数就行了.