作业帮 > 综合 > 作业

matlab 中fprintf

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/04/28 01:33:46
matlab 中fprintf
clear all;
syms x
y = (1500-x)*(1+0.0015*x);
ezplot(y,[1000,2000]);
dydx = diff(y,x);
xsh= solve(dydx);
ymax=subs(y,x,xsh);
ezplot(y,[0 1500]) ;
hold on;
plot(xsh,ymax,'-ro');
grid on;
hold off;
fprintf('the best count is %d dollars/n',xsh)
运行后
Error using ==> fprintf
Function is not defined for 'sym' inputs.
Error in ==> one1 at 13
fprintf('the best count is %d dollars/n',xsh)
matlab 中fprintf
clear all;
syms x
y = (1500-x)*(1+0.0015*x);
ezplot(y,[1000,2000]);
dydx = diff(y,x);
xsh= solve(dydx);
ymax=subs(y,x,xsh);
ezplot(y,[0 1500]) ;
hold on;
plot(double(xsh),double(ymax),'-ro');
grid on;
hold off;
fprintf('the best count is %s dollars/n',char(xsh))