MATLAB Answers

0

how to get float answer and not a Fraction ?

Asked by tomer polsky on 5 May 2019
Latest activity Edited by Stephan
on 5 May 2019
lets say this is my code ,(simple code ) :
for some reason my answer is fraction and float point anser ,how to fix the format ?
clc;
clear all;
syms R2
R1=200
eqn=(12*R2)/(R2+R1)==5
sol_R2=simplify(solve(eqn,R2))

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Stephan
on 5 May 2019
Edited by Stephan
on 5 May 2019

Hi,
symbolic calculatuions are always precise. If you want a float point answer, you have to tell it to matlab:
% one way:
sol__R2_num1 = double(sol_R2)
% The other way:
sol_R2_num2 = simplify(vpasolve(eqn,R2))
Best regards
Stephan

  0 Comments

Sign in to comment.