MATLAB Answers

0

. Find a MATLAB built in function that is used to find the lowest common denominator of fractions.

Asked by David Durost on 22 Aug 2019
Latest activity Commented on by Walter Roberson
on 23 Aug 2019 at 17:42
Hello, I new to Matlab and I need help with this one problem.
"Find a MATLAB built in function that is used to find the lowest common denominator of fractions. Then use that function to show that the lowest common denominator of (hint, your input and solution will only contain one denominator values.'

  4 Comments

Show 1 older comment
I've already done a search and that is why I finally came here. I'm asking for help with writing the function.
Would it be something like L = lcm(A,B) or
builtin(function,x1,...,xn)[y1,...,yn] = builtin(function,x1,...,xn)?
The first of those. builtin() has some fairly specific uses. I have rarely had need for it.
Okay, I 've tried
x=(1/4);
y=(1/10);
L=lcd(x,y);
and
L=lcd(4,10);
built in(function,4,10);
I would really appericate help with the syntax?

Sign in to comment.

2 Answers

Answer by Walter Roberson
on 23 Aug 2019 at 16:28

[n1, d1] = rat(1/4);
[n2, d2] = rat(1/10);
com = lcm(d1, d2);
Now that you have the least common multple of the denominators, you can calculate the equivalent fractions. The code is quite easy, but I will not provide it as you are obviously working on an assignment.

  0 Comments

Sign in to comment.


Answer by David Durost on 23 Aug 2019 at 16:43

I would say thanks however, 'com=1cm(d1,d2); is a Unexpected MATLAB expression. I don't appericate the concending remark of how easy this code is. It may be easy for you but not everyone can be a genious like you.

  3 Comments

lcm(4,10) is 20. What do you get when you multiply 1/4 by 20? How many 20'th is 1/4 ? What do you get when you multiply 1/10 by 20? How many 20'th is 1/10 ?
Be sure to distinguish between 'l' (lower-case L) and '1' (digit for the number One)

Sign in to comment.