Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
无论如何在不使用 numden() 函数的情况下在 MATLAB 中获取分子和分母?例如: format rational x=5/2;
format rational x=5/2;
我想获得 5 作为 num 和 2 作为 den。你能帮我解决这个棘手的问题吗?
怎么样
[N,D] = rat(2.5)
否则,如果你坚持自己做,你可以做类似的事情
N = 2.5; D=1; while (int64(N)~=N), N=N*10; D=D*10; end g = gcd(N,D); D = D/g; N = N/g;