该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
一matlab小白.........
function AQI=fun(s,m,n)
z=length(s);
for k=1:z
if(s(k)>=0)&&(s(k)<=50)
a(k)=s(k);
else if (s(k)>50)&&(s(k)<=150)
a(k)=1/2*(s(k)-50)+50;
else if (s(k)>150)&&(s(k)<=475)
a(k)=2*(s(k)-150)/13+150;
end
end
end
if(m(k)>=0)&&(m(k)<=40)
b(k)=5*m(k)/4;
elseif (m(k)>40)&&(m(k)<=80)
b(k)=5*(m(k)-40)/4+40;
elseif (m(k)>80)&&(m(k)<=180)
b(k)=(m(k)-80)/2+80;
else if (m(k)>180)&&(m(k)<=280)
b(k)=(m(k)-180)/2+180;
else if (m(k)>280)&&(m(k)<=565)
b(k)=100*(m(k)-280)/265+280;
end
end
end
end
if(n(k)>=0)&&(n(k)<=50)
c(k)=n(k);
elseif(n(k)>50)&&(n(k)<=150)
c(k)=1/2*(n(k)-50)+50;
elseif(n(k)>150)&&(n(k)<=250)
c(k)=1/2*(n(k)-150)+150;
end
if(n(k)>250)&&(n(k)<=350)
c(k)=1/2*(n(k)-250)+250;
end
end
这个编辑在command window出现??? function AQI=fun(s,m,n)
|
Error: Function definitions are not permitted in this context. 错误.........那怎眼编呢?在M文件的编辑器窗口怎样编写?