y=log(abs(b+c/x)); end disp(['y=',num2str(y)]); (2) 用switch语句实现计算: a=input('请输入a的值:'); b=input('请输入b的值:'); c=input('请输入c的值:'); x=input('请输入x的值:'); switch fix(x/0.5) case {1,2} y=a*x^2+b*x+c; ...
b=input('请输入b: '); c=input('请输入c: '); for x=0.5:1:5.5 switch floor(x/0.5) case {1,2} y=a.*(x.^2)+b.*x+c; case {3,4,5,6} y=a*(sin(b)^c)+x; case {7,8,9,10} y=log(abs(b+c./x)); end
y=log(abs(b+c/x)); end disp(['y=',num2str(y)]); (2) 用switch语句实现计算: a=input('请输入a的值:'); b=input('请输入b的值:'); c=input('请输入c的值:'); x=input('请输入x的值:'); switch fix(x/0.5) case {1,2} y=a*x^2+b*x+c; ...