matlab如何给一个变量赋多个值进行函数运算?

2024-11-28 15:36:04
推荐回答(1个)
回答1:

a=[20 30 50 80];

b=[1,2];
c=[1,2];

 ind=fullfact([length(a) length(b) length(c) ]);
out(:,1)=a(ind(:,1));
f=find(ind(:,2)==1);
out(f,2)=sind(out(f,1));
f=find(ind(:,2)==2);
out(f,2)=-sind(out(f,1));

f=find(ind(:,3)==1);
out(f,3)=tand(out(f,1));
f=find(ind(:,3)==2);
out(f,3)=-tand(out(f,1));