MATLAB Answers

How to rearrenge function with inputs given?

1 view (last 30 days)
Berke Kadir Türker
Berke Kadir Türker on 6 Jul 2021
Answered: the cyclist on 6 Jul 2021
f=m.a (where we know m=5 and a=10)
let's say we have that function
but we also could've need
a=f/m (where we know F=10 m=2)
m=f/a(where we know F=10 a=4)
in another problem.
This means more and more functions for every other variable and also means that much error handling.
I don't know what's the term i need can you help?

Sign in to comment.

Answers (1)

the cyclist
the cyclist on 6 Jul 2021
Option 1
You could do something that is GUI-driven, where the user enters values into textboxes that you have labeled as
  • acceleration
  • mass
  • energy
  • (etc)
but allow them to leave one box blank. Then you can infer from which box is empty, which formula to use.
Option 2
You could require the user to enter the values as strings, with the units included, e.g.
'65 Joules'
and then infer the quantity from the units, and calculate accordingly.




Community Treasure Hunt

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

Start Hunting!