matlab 中fprintf

[复制链接]
查看11 | 回复2 | 2011-3-16 18:41:26 | 显示全部楼层 |阅读模式
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)
求解释

回复

使用道具 举报

千问 | 2011-3-16 18:41:26 | 显示全部楼层
clear all; syms xy = (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))
回复

使用道具 举报

千问 | 2011-3-16 18:41:26 | 显示全部楼层
不要fprintf,直接printf
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行