Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can we precise the substituted values (to 04 numbers )after differentiation?

1 回表示 (過去 30 日間)
Naga Ranjith Kumar Addagalla
Naga Ranjith Kumar Addagalla 2016 年 4 月 18 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have differentiated the polynomial equation and have substituted the values to the variables. But I need to precise the values. Can any one please provide with answer?
  1 件のコメント
Naga Ranjith Kumar Addagalla
Naga Ranjith Kumar Addagalla 2016 年 8 月 16 日
I am thankful for your answer. As I have solved by myself, I haven't seen the reply earlier. Please apologize.

回答 (1 件)

Maitreyee Mordekar
Maitreyee Mordekar 2016 年 8 月 8 日
I assume that you are using MATLAB 2016a version. I have a small code snippet that I think is your concern.
syms x;
y=x.^3;
z=diff(y,1);
x1=3.0912345678;
z1=subs(z,x1);
This would display the z1 as a fraction. Just convert the z1 variable to a floating number precision. You may use single or double point precision.
z2=single(z1); %Single precision
z3=double(z1); %Double precision
This should return the result in a numeric format with the precision according to the double or single data type.
In case you can afford to stay in the symbolic domain, you may use the variable-precision arithmetic. The result will be a symbolic data and not a numeric one.
z4 = vpa(z1,10);
You may refer to variable precision arithmetic for the documentation.
Hope it helps.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by