matlab中球定积分以后,结果如何以小数形式输出?x4=0:0.01:2;y4=sin(x4)-exp(1/4*x4)+1;S=int('y4','x4',0,2);simplify(S);fprintf('真实面积为 p_e=%f\n',S);错误是Error using ==> fprintfFunction is not defined for 'sym' inputs.Error i
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 14:23:35
matlab中球定积分以后,结果如何以小数形式输出?x4=0:0.01:2;y4=sin(x4)-exp(1/4*x4)+1;S=int('y4','x4',0,2);simplify(S);fprintf('真实面积为 p_e=%f\n',S);错误是Error using ==> fprintfFunction is not defined for 'sym' inputs.Error i
matlab中球定积分以后,结果如何以小数形式输出?
x4=0:0.01:2;
y4=sin(x4)-exp(1/4*x4)+1;
S=int('y4','x4',0,2);
simplify(S);
fprintf('真实面积为 p_e=%f\n',S);
错误是
Error using ==> fprintf
Function is not defined for 'sym' inputs.
Error in ==> Lx40960054_3_5 at 43
fprintf('真实面积为 k=%d\n',S);
matlab中球定积分以后,结果如何以小数形式输出?x4=0:0.01:2;y4=sin(x4)-exp(1/4*x4)+1;S=int('y4','x4',0,2);simplify(S);fprintf('真实面积为 p_e=%f\n',S);错误是Error using ==> fprintfFunction is not defined for 'sym' inputs.Error i
>> S = quad('sin(x)-exp(x/4)+1',0,2,0.001);
>> fprintf('真实面积为 p_e=%f\n',S);
真实面积为 p_e=0.821262
int函数是对符号积分(即不定积分),所以才会报错说,fprintf函数未定义sym形式输入
如果是数值积分(即定积分),用quad会好点.
就算想输出符号积分,也行,不过要这样写,
>> S = int('sin(x)-exp(x/4)+1',0,2);
>> simplify(S);
>> disp(S)
7 - 4*exp(1)^(1/2) - cos(2)
>> eval(S)
ans =
0.8213