MATLAB Answers

How to combine numerator and denominator in original form

22 ビュー (過去 30 日間)
Sultan
Sultan 2017 年 10 月 11 日
コメント済み: Sultan 2017 年 10 月 12 日
Hello Everyone,
suppose I have one vector say v =[ 2021429518004981288989071978287/3538031894290286283107218751488, 16596427267731862375274731305887/28304255154322290264857750011904]. Its numerator is Nv = [2021429518004981288989071978287, 16596427267731862375274731305887] and denominator is Dv= [3538031894290286283107218751488, 28304255154322290264857750011904]. I have done it by using [Nv, Dv] = numden(sym(v)) and 'sym' because my v is in symbolic form. Now suppose I have only Nv and Dv and I want to find exactly v (in same form) then how can I get it. Please help me.
Thanks!
:MSA

  0 件のコメント

サインイン to comment.

採用された回答

Karan Gill
Karan Gill 2017 年 10 月 11 日
編集済み: Karan Gill 2017 年 10 月 11 日
The answer is in this example on the sym doc page: https://www.mathworks.com/help/symbolic/sym.html#bu7u7ur-6
>> Nv = sym(["2021429518004981288989071978287", "16596427267731862375274731305887"])
Nv =
[ 2021429518004981288989071978287, 16596427267731862375274731305887]
>> Dv = sym(["3538031894290286283107218751488", "28304255154322290264857750011904"])
Dv =
[ 3538031894290286283107218751488, 28304255154322290264857750011904]
>> Nv./Dv
ans =
[ 2021429518004981288989071978287/3538031894290286283107218751488, 16596427267731862375274731305887/28304255154322290264857750011904]

  1 件のコメント

Sultan
Sultan 2017 年 10 月 12 日
Thanks dear Karan Gill. But when I run Nv = sym(["2021429518004981288989071978287", "16596427267731862375274731305887"]), then it shows an error: Error: The input character is not valid in MATLAB statements or expressions.

サインイン to comment.

その他の回答 (1 件)

KSSV
KSSV 2017 年 10 月 11 日
v = Nv./Dv ;

  1 件のコメント

Sultan
Sultan 2017 年 10 月 11 日
Thanks KSSV!
It is not returning exact form.

サインイン to comment.

サインイン してこの質問に回答します。


Translated by