matlab中solve语句y=input('please input relativeroughness:');z=input('please input Re:');[x]=solve('1/sqrt(x)=1.74-2*log10(2*y+18.7/(z*sqrt(x)))','x');x=subs(x); fprintf('沿程损失系数是%15.14f\n',x)当y=0.01,z=8e7结果x=0但是把数直接
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 02:36:13
matlab中solve语句y=input('please input relativeroughness:');z=input('please input Re:');[x]=solve('1/sqrt(x)=1.74-2*log10(2*y+18.7/(z*sqrt(x)))','x');x=subs(x); fprintf('沿程损失系数是%15.14f\n',x)当y=0.01,z=8e7结果x=0但是把数直接
matlab中solve语句
y=input('please input relativeroughness:');
z=input('please input Re:');
[x]=solve('1/sqrt(x)=1.74-2*log10(2*y+18.7/(z*sqrt(x)))','x');
x=subs(x);
fprintf('沿程损失系数是%15.14f\n',x)
当y=0.01,z=8e7结果x=0
但是把数直接输入方程后的出了结果约为0.038
求教是为什么
matlab中solve语句y=input('please input relativeroughness:');z=input('please input Re:');[x]=solve('1/sqrt(x)=1.74-2*log10(2*y+18.7/(z*sqrt(x)))','x');x=subs(x); fprintf('沿程损失系数是%15.14f\n',x)当y=0.01,z=8e7结果x=0但是把数直接
% 按理,你直接使用solve求解你给定的那个语句时,y,z作为符号变量,应该是很难得到解的
% 试了下,找不到解析解
% 当把y,z的值先代入时,可以得到你所说的解
% 代码贴如下
y=input('please input relativeroughness:');
z=input('please input Re:');
syms x;
exp = 1.74-2*log10(2*y+18.7/(z*sqrt(x))) - 1/sqrt(x);
x=solve(exp, 'x');
x=vpa(x);