Matlab code for fractions

34 Ansichten (letzte 30 Tage)
Johnny McKenney
Johnny McKenney am 27 Sep. 2020
Bearbeitet: John D'Errico am 26 Nov. 2024
How would I write 1.5/s as a num[ ] den[ ] code in matlab?

Akzeptierte Antwort

John D'Errico
John D'Errico am 27 Sep. 2020
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 Kommentare
Johnny McKenney
Johnny McKenney am 27 Sep. 2020
I do not know S. I think it is 1. We are meant to write
numx = [ 1 2 3]
denx = [1 2 3]
as an example. I just can't figure out how to do that with 1.5/S or 1/S+2
John D'Errico
John D'Errico am 26 Nov. 2024
Bearbeitet: John D'Errico am 26 Nov. 2024
syms s
F = 1.5/s
[N,D] = numden(F)
N =
3
D =
2*s

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by