❔ Using a loop I need to increment voltage by 0.1.
At each increment the power dissipated in R2 (P2) should be calculated (should be able to use P2 = V2 * I2). The voltage loop should stop when P2 = 1.5.
Having a hard time figuring out how to get P2 to be calculated at each increment since V2 and I2 would be needed and those would need to calculated first.
14 Replies
90% sure that code is rubbish
this is another attempt
why do while?
would even suffice if you simply need to increase the voltage by
0.1
per increment, then in the loop you can do whatever you need to do
what are you actually trying to calculate? can't figure it out
looks like ohms law to me, but to what endTrying to calculate power( P = VI ).
Let me grab a photo of the circuit for clarification
essentially I'm trying to calculate what source voltage for V1 would deliver 1.5 watts to R2
the loop itself should terminate after it reaches that point
ah good old resistor circuits, got 2 in series with the 1 in parallel, you don't necessarily need to brute force this with software honestly
though I haven't done electronics in a while, you should be able to trial and error this one pretty quick
uhh would 25 volts do it?
not sure if my brain is awake enough to remember electronics stuff I barely paid attention to in the first place
haha
not sure what source voltage you would need, can't quite recall how parallel resistors affected voltage
if memory serves, resistors in parallel doesn't change the voltage across the terminals
only get a voltage divider effect from series resistors
use an infinite loop (
while(true)
) and check the conditions and break manually
If you need the voltage in an increment of 0.1 rounding up:
ceil(V * 10) / 10
On paper
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.