Problem 60795. Ohm’s Law - Calculate Resistance
Ohm’s Law states that resistance R can be calculated as:R=V/I
where:
- V is the voltage (in volts)
- I is the current (in amperes)
- R is the resistance (in ohms)
Write a function to compute resistance given voltage and current.
Solution Stats
Problem Comments
-
3 Comments
William
on 16 Feb 2025
This formula is incorrect. It calculates power rather than resistancee.
Joshua
on 17 May 2025
@William no, the formula is correct*
Resistance = Voltage / Current
The general formula for electrical power is:
Power = Voltage * Current
(at least in DC, more complicated in AC)
* as of 2025-05-17. Apologies if the problem was corrected since your comment.
Joshua
on 17 May 2025
The test suite is far too small, nowhere near comprehensive enough.
At the moment, any solution that returns 0 will pass.
Need to add more tests, such as V = 10, I = 11.
Solution Comments
Show commentsProblem Recent Solvers196
Suggested Problems
-
Ohm’s Law - Calculate Resistance
196 Solvers
More from this Author20
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!