how can i correct this code and get rid of error? urgent help please
1 次查看(过去 30 天)
显示 更早的评论
fprintf('\n The equation by Lagrange is:\n');
yvalue
fprintf('\n The answer for part c\n');
fprintf('The value of Volume at 1.05 bar by Lagrange is %f m^3\n',vpa(subs(yvalue,xvalue,x)));
fprintf('\n The answer for part d\n');
fprintf('\n The absolute difference between volume by predicted model and Lagrange interpolation is %f m^3\n',abs((A(1)*exp(A(2)*x))-(vpa(subs(yvalue,xvalue,x)))));
end
i wrote this code for my homework but gives error in bold underlined line. how can i correct it. i use Matlab R2013a . thank you.
回答(1 个)
Simon Chan
2022-1-22
You need to specify the number of digits after the decimal point.
For example, %.2f or %.4f for 2 and 4 digits after the decimal point respectively.
%f states nothing and give you an error
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Probability Distributions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!