Matlab code for fractions
조회 수: 41 (최근 30일)
이전 댓글 표시
How would I write 1.5/s as a num[ ] den[ ] code in matlab?
댓글 수: 0
채택된 답변
John D'Errico
2020년 9월 27일
Confusing question.
Do you know the value of s?
s = 7
s =
7
>> 1.5/s
ans =
0.214285714285714
>> format rat
>> 1.5/s
ans =
3/14
Do you not know what is is, so you want to use s in a symbolic form?
syms s
1.5/s
ans =
3/(2*s)
댓글 수: 2
John D'Errico
2024년 11월 26일
편집: John D'Errico
2024년 11월 26일
syms s
F = 1.5/s
[N,D] = numden(F)
N =
3
D =
2*s
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!